Matthew alleges that Jesus being born in Bethlehem fulfills a prophecy. In Matthew 2:4-6 King Herod is concerned about the birth of the “King of the Jews.”
When he had called together all the people’s chief priests and teachers of the law, he asked them where the Christ was to be born. “In Bethlehem in Judea,” they replied, “for this is what the prophet has written: ‘But you, Bethlehem, in the land of Judah, are by no means least among the rulers of Judah; for out of you will come a ruler who will be the shepherd of my people Israel.'” (NIV)
While the quote from the prophet, Micah, appears to predict Jesus will come from the city of Bethlehem, he was not quoted precisely. Micah 5:2 actually reads:
But you, Bethlehem Ephrathah, though you are small among the clans of Judah, out of you will come for me one who will be ruler over Israel, whose origins are from of old, from ancient times. (NIV)
The original quote makes it clear that Micah was referring to a clan named Bethlehem and not a city.
The Micah quote has also been taken out of context, originally showing no indication of being a messianic prophecy and referring to a military leader who will “deliver us from the Assyrian when he invades our land.” (v. 6)
Additionally there is no evidence outside the statements of Matthew and Luke that Jesus was in fact born in Bethlehem, and even they do not agree on the details. Luke has Joseph and Mary in Bethlehem from Nazareth for the dubious reason of partaking in a census in 6 CE, while Matthew has them starting in Bethlehem and escaping to Nazareth by way of Egypt at least ten years earlier.