Augustus Caesar kept a regular check on his empire for tax purposes. St Luke recorded one of these as the background to his version of the nativity story. It went like this: Joseph of Galilee was of King David's line and David was born in Bethlehem in Judea, so Joseph had to travel to Bethlehem to be registered for the Roman census there. Wrong. Romans were taxed by property, not lineage, and Joseph owned property in Nazareth, not Bethlehem.
But there are more problems. Matthew said that the Judea of the day was ruled by King Herod, not a provincial governor. So the Romans did not control it. How then could they run a census there?
Luke is even more inaccurate. Joseph came from Galilee, and Galilee was not under Roman control at that time, either, so Joseph had no reason to pay a Roman tax.
So why are these stories included?
It's because the OT said that the Messiah would be born in Bethlehem. So Luke and Matthew had to find some reason to get Jesus born there. This was the best they could contrive.