2 In those days Caesar Augustus issued a decree that a census should be taken of the entire Roman world. 2 (This was the first census that took place while[e] Quirinius was governor of Syria.) 3 And everyone went to their own town to register. 4 So Joseph also went up from the town of Nazareth in Galilee to Judea, to Bethlehem the town of David, because he belonged to the house and line of David. 5 He went there to register with Mary, who was pledged to be married to him and was expecting a child.
.
I prefer to go with what the scriptures said.
Anyway the feast was the reason for the decree.
Joseph obviously didn’t stay in his home town of Nazareth, but followed Yehova’s orders to go to the Feast of Tabernacles in Jerusalem.
There was no room at any inn because millions were in town for the feast.
.