Luke chapter 2: Mary and Joseph return to Bethlehem (where Jesus is born) because of a census happening at the time. Why? Apparently these kinds of censuses were for tax purposes and occurred every 14 years in the Roman empire (of which both Nazareth and Bethlehem were a part). A number of commentators (based on historical evidence) suggest that Joseph had to return to his home town because he owned property there, not simply because it was his home town (although that would be a reason that he might own property there). Apparently censuses in this day registered people according to the property that they owned. On the other hand, Luke 2:4 seems to emphasize the family relationship to the town specifically (probably for the reason I note below). Regardless, we know that the census took Mary and Joseph back to Bethlehem.
Even in the story of the census, the point of the story isn’t just to tell why or how Jesus was born in Bethlehem, but rather to highlight Joseph’s relationship (and thereby Jesus’ relationship) with king David (Luke 2:4), the great king of Israel. It was from the line of King David that the Messiah was expected to come. Furthermore, the Jewish expectation was that the Messiah would be born in Bethlehem (Micah 5:2). In other words, the point of the story is that Jesus is the Messiah (not so much just to tell us where he was born).