Why was Jesus born in Bethlehem?

Bethlehem was prophesied to be the birthplace of Jesus.

Micah 5:2 But thou, Bethlehem Ephratah, though thou be little among the thousands of Judah, yet out of thee shall he come forth unto me that is to be ruler in Israel; whose goings forth have been from of old, from everlasting.

In Hebrew, Bethlehem means house of bread.

Jesus said he was the bread of life from heaven.

John 6:35 And Jesus said unto them, I am the bread of life: he that cometh to me shall never hunger; and he that believeth on me shall never thirst.

Bethlehem was where the Temple flocks were raised. Migdal Eder, the Tower of the Flock, was the place where lambs for the Temple were born and raised.

Micah 4:8 And thou, O tower of the flock, the stronghold of the daughter of Zion, unto thee shall it come, even the first dominion; the kingdom shall come to the daughter of Jerusalem.

Levitical shepherds would separate the lambs, choosing only the firstborn males without a blemish to be taken to Jerusalem to be offered as sacrifices in the Temple.

Jesus was the Lamb of God who would be sacrificed for the sins of the world.

Bethlehem was the Prophetic place for the lamb of God to be born.

John 1:34 And I saw, and bare record that this is the Son of God.

John 1:35 Again the next day after John stood, and two of his disciples;

John 1:36 And looking upon Jesus as he walked, he saith, Behold the Lamb of God!

Hebrews 10:5 Wherefore when he cometh into the world, he saith, Sacrifice and offering thou wouldest not, but a body hast thou prepared me:

Luke 2:1 Now when Jesus was born in Bethlehem of Judaea in the days of Herod the king, behold, there came wise men from the east to Jerusalem,

Luke 2:2 Saying, Where is he that is born King of the Jews? for we have seen his star in the east, and are come to worship him.

Luke 2:3 When Herod the king had heard these things, he was troubled, and all Jerusalem with him.

Matthew 2:4 And when he had gathered all the chief priests and scribes of the people together, he demanded of them where Christ should be born.

Matthew 2:5 And they said unto him, In Bethlehem of Judaea: for thus it is written by the prophet,

Matthew 2:6 And thou Bethlehem, in the land of Juda, art not the least among the princes of Juda: for out of thee shall come a Governor, that shall rule my people Israel.

Matthew 2:7 Then Herod, when he had privily called the wise men, enquired of them diligently what time the star appeared.

Matthew 2:8 And he sent them to Bethlehem, and said, Go and search diligently for the young child; and when ye have found him, bring me word again, that I may come and worship him also.

Matthew 2:9 When they had heard the king, they departed; and, lo, the star, which they saw in the east, went before them, till it came and stood over where the young child was.

Matthew 2:10 When they saw the star, they rejoiced with exceeding great joy.

Matthew 2:11 And when they were come into the house, they saw the young child with Mary his mother, and fell down, and worshipped him: and when they had opened their treasures, they presented unto him gifts; gold, and frankincense and myrrh.

Matthew 2:12 And being warned of God in a dream that they should not return to Herod, they departed into their own country another way.