This Bible contradiction is from the Skeptic's Annotated Bible.
They lived in Nazareth, and traveled to Bethlehem because of a census.
Luke 2:1-7 View context
And it came to pass in those days, that there went out a decree from Caesar Augustus, that all the world should be taxed.
([And] this taxing was first made when Cyrenius was governor of Syria.)
And all went to be taxed, every one into his own city.
And Joseph also went up from Galilee, out of the city of Nazareth, into Judaea, unto the city of David, which is called Bethlehem; (because he was of the house and lineage of David:)
To be taxed with Mary his espoused wife, being great with child.
And so it was, that, while they were there, the days were accomplished that she should be delivered.
And she brought forth her firstborn son, and wrapped him in swaddling clothes, and laid him in a manger; because there was no room for them in the inn.
They lived in a house in Bethlehem, and moved to Nazareth after returning from Egypt.
Matthew 2:1-2 View context
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,
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.