There are a number of explanations for why Jesus was born in Bethlehem.
First, there are the historic reasons. The Gospels, unfortunately, offer conflicting data. The Gospel of Luke indicates Jesus was born in Bethlehem because a census was being taken that required Joseph to leave Nazareth to return to his ancestral home of Bethlehem. That census, by the way, was conducted in 4 c.e. The Gospel of Matthew implies Joseph and Mary were already living in Bethlehem when Jesus was born. The Gospels of Mark and John don't address the Nativity and simply refer to Jesus was being from Nazareth.
Bethlehem was the place where David was born. Samuel crowned David king of Israel in Bethlehem. David was a descendant of Ruth and Boaz, who were married in Bethlehem. If it wasn't the census that brought Joseph to Bethlehem, then he probably was there for ancestral reasons.
There is also the story of Rachel, the beloved wife of Jacob and mother of Joseph and Benjamin. When Rachel died, Jacob buried her just outside of Bethlehem. This adds to the historic significance of Bethlehem as a holy place.
There are theological reasons for Jesus being born in Bethlehem. Micah 5:2 offers the prophecy that it will be from Bethlehem that a new David will come, "one who is to rule Israel, whose origin is from of old. . . ." Christians believe Jesus being born in Bethlehem fulfills this prophecy.
A couple of outstanding early Christian thinkers and leaders give an interesting twist to the story of Jesus' birth. The second century defender of the faith, Justin Martyr, wrote that Joseph and Mary took refuge outside of Bethlehem in a cave. In the third century, Origen of Alexandria placed the cave inside Bethlehem. What is so interesting about this is the cave of Jesus' birth is the same cave where the Phrygian god of vegetation, Attis, was said to have been born.* This attribution of Origen's was made when Christians were still being persecuted and the desire to persuade others of Christianity's relevance was especially keen.
I want to suggest a third possible explanation, one that comes to me from an idea of C.G. Jung's. This explanation derives from the symbolic significance of Bethlehem. Bethlehem was a sleepy village at the time of Jesus' birth. It is located about five and a half miles southwest of mighty Jerusalem, the historic capitol of Israel. Dr. Jung's idea was that Jesus was born in Bethlehem, rather than in Jerusalem, because God enters our lives through the back door (the unconscious), not through the well-developed parts of ourselves (the ego). Jesus was born in Bethlehem to illustrate symbolically that God finds His way into our lives by incarnating unexpectedly in the devalued part of ourselves. We often become aware of God's presence when we are surrounded by personal darkness (Winter Solstice), frequently through dreams, visions or someone's witness that brings light and clarity to a part of our lives that previously was in fog. Spiritual awakenings happen when we are in altered states of consciousness - in prayer, meditation, worship, fasting, singing, chanting, etc. Bethlehem symbolizes this altered state in contrast to Jerusalem that typlifies our normal, well-developed way of being in the world.
This Christmas - or any time you hunger to find God - look in the dark, remote, undeveloped part of yourself for what is stirring about, for what is restless, that disturbs you and won't leave you alone. This is the movement of the Holy within, the place where you will find your own inner Bethlehem; that place in you where God comes alive.
* Attis, like Jesus, died tied to a tree then later resurrected to new life. The observance of Attis' death and resurrection was around the time of Easter. Key parts of that observance included the following. Each March 22nd a pine tree was cut and taken to the shrine of Cybele, decorated with violets, then an effigy of a young man (Attis) was tied to the tree. On the 24th, the Day of Blood, priests splattered some of their blood on both an altar and the tree. Some would also emasculate themselves. The next day, the 25th of March, the Spring equinox, Attis' resurrection was celebrated with a licentious carnival, complete with disguises that allowed every man to say and do whatever he pleased with impunity.
Since Easter is celebrated around the time of the observance of Attis' death and resurrection, it is not too surprising that Jesus' birth came to be seen as happening in the same place that Attis' birth did.