Nowhere in the gospels does it say "three wise men visited Jesus." Matthew's gospel (chapter 2) says"After Jesus was born in Bethlehem in Judea during the time of King Herod,Magi from the east came to Jerusalem" - they were looking for the child who had been born king of the Jews.
Tradition has it that there were three wise men (or Magi) because Matthew 2:11 says they left gifts of gold, incense and myrrh.
We know that the magi were wise men from "the East," most likely Persia, or modern-day Iran. This means the wise men traveled 800 to 900 miles to see the Christ child. Most likely, the magi knew of the writings of the prophet Daniel, who in time past had been the chief of the court seers in Persia. Daniel 9:24-27 includes a prophecy which gives a timeline for the birth of the Messiah. Also, the magi may have been aware of the prophecy of Balaam (who was from the town of Pethor on the Euphrates River near Persia) in Numbers 24:17. Balaam's prophecy specifically mentions a “star coming out of Jacob.”
The wise men were guided to look for the King of the Jews by a miraculous stellar event, the “Star of Bethlehem,” which they called “His star” (Matthew 2:2). They came to Jerusalem and asked concerning the birth of Christ, and they were directed to Bethlehem (Matthew 2:4–8). They followed God’s guidance joyfully (Matthew 2:10). When they arrived in Bethlehem, they gave costly gifts to Jesus and worshiped Him. God warned them in a dream against returning to Herod, so, in defiance of the king, they left Judea by another route (Matthew 2:12).
So, the magi were men who 1) read and believed God's Word, 2) sought Jesus, 3) recognized the worth of Christ, 4) humbled themselves to worship Jesus, and 5) obeyed God rather than man. They were truly wise men!