If you previously tried to sync your iTunes with your iPhone but the sync did not effectuate until the end (failed or incomplete sync) this could have corrupted your iPhone Library file which contains all the listings of your iPhone media tracks/playlists, etc.
iTunes sync would first deal with this file deleting and then updating it after which it will add/remove tracks physically on your device. If a previous iTunes sync failed to execute correctly or was interrupted, iTunes would have deleted or corrupted your iPhone Library file while keeping the tracks physically on your iPhone. An iTunes sync could fail due to many reasons - USB cable damaged, USB slot on computer or device damaged, manual abrupt unplug, etc.
This would result in iTunes failing to see your iPhone tracks the next time you connect your iPhone since iTunes used the iPhone library file solely to recognize the content on your iPhone.
On your iPhone, on the other hand, you could continue seeing and be able to play the tracks normally.
If you have all of your iTunes tracks already loaded in your iTunes library, simply reset your iPhone to factory settings via iTunes and let iTunes fully sync with your iPhone. This will sort the issue out.