This claim comes from various 15th- and 16th-century Greek and Italian chronicles, which portray him as sort of an all-powerful philosopher-king, maybe even a new Alexander the Great. Naturally he was raised speaking the native Turkish of the Ottomans, but on top of that he is also said to have spoken Greek, Latin, Arabic, Persian, and Hebrew.
He may have learned another language from his mother. We only know her Turkish name (Hüma Hatun), but she was a convert to Islam and was probably originally a Christian Greek or Serbian, or maybe a Jewish woman of unknown ethnicity. So Mehmed could have possibly learned Greek, Serbian, or maybe even Hebrew from her, although we don’t actually have any idea what language she spoke and there’s no real evidence that he learned a second language from her. It’s even possible that her family had originally been Christian (or Jewish) but they had converted in a previous generation, so for all we know, her native language was Turkish too.
Mehmed could have learned other languages from a tutor as a child; unfortunately one of the other answers here was removed, but the poster noted that it’s relatively easy for children to pick up several languages, compared to adults anyway. But Mehmed was known to be an extremely stubborn child who resisted almost all attempts to educate him, in languages or in any other subject. The only tutor who was successful was Mullah Gürani:
“‘Your father,’ he said, ‘has sent me to instruct you, but also to chastise you in case you should not obey me.’ When Mehmed laughed at these words Mullah Gürani gave him such a beating that the boy stood in awe of him forever after. In a short time he had learned the Koran.” (Babinger, pg. 24)
So he learned Arabic at a young age (he was about 11 or 12 at the time), but only after his tutor beat him into compliance first!
For Greek and Latin. it seems unlikely that Mehmed actually learned to read or speak them, because as an adult he could only read Greek and Latin works of science, religion, philosophy, and other literature when they were translated:
"For he studied all the writings of the Arabs and Persians, and whatever works of the Greeks had been translated into the language of the Arabs and Persians" (Kritovoulos, pg. 14)
Kritovoulos, a Greek author who knew Mehmed personally, seems to use “Arabs and Persians” to refer to the Ottomans, so presumably Mehmed had these works translated into Turkish. (It’s also possible that Kritovoulos and other European writers didn’t know or care that Arabic, Persian, and Turkish were all completely different languages, since they were all written in the same script.)
The other issue here, as I mentioned at the beginning, is that sometimes Christian European authors were trying to show why Mehmed couldn’t be defeated. He had conquered the remnants of the Roman Empire and the Ottomans were expanding deep into Europe; later in the 15th and 16th centuries, some people were even afraid the Ottomans might even conquer all the Christian states of Europe. How could they explain their own relative weakness? Portraying Mehmed as a legendary figure, someone who was almost all-powerful and all-knowing, helped excuse their own failure to prevent him from conquering Constantinople. He was so wise, they argued, that he could even speak four, or five, or six languages!
In reality, in addition to his native Turkish, he could read Arabic, the religious and scientific language of Islam; and probably also Persian, the common language in the Ottoman Empire for philosophy and other literature. He apparently could not speak or read Greek, Latin, Hebrew, Serbian, or any other languages, despite exaggerated claims to the contrary.
Sources:
Kritovoulos, History of Mehmed the Conqueror, trans. Charles T. Riggs (Princeton University Press, 1954)
Christos G. Patrinelis, “Mehmed II the Conqueror and his presumed knowledge of Greek and Latin”, in Viator 2 (1971)
Franz Babinger, Mehmed the Conqueror and His Time (Princeton University Press, 1992)
Apparently Babinger writes more about this in Aufsätze und Abhandlungen zur Geschichte Suüdosteuropas und der Levante, vol. 1 (Munich 1962), particularly on pages 182-183. But I haven't been able to find an accessible copy of it.