The comet of 5 BC was visible for a very long time – 70 days. The Magi see this star rise in the east and get ready and set out for Jerusalem.
I see the appearance of the star as marking the birth of the Messiah as the exact time of its appearance seems to be important. After Jesus was born, he was circumcised on the 8th day and dedicated in the Temple on the 40th day after birth. Mary and Joseph are offering a sacrifice of two doves when Simeon and then Anna come up and prophesy over him (Luke 2:21-38). Having done this, they return to Bethlehem and are living in a house, not a stable. Sometime later, maybe a month later the Magi turn up.
The 70 days or 2 months and 10 days time scheme implies that the journey either took a very long time, although it should not take this long, or that the wise men in search of the Messiah were held up by Herod in his palace for a very long time. The latter is implied by their joy that the star was still visible when they continued their journey from Jerusalem to Bethlehem (Matt 2:9 ).
The whole time scheme seems strange unless you consider that Herod might have been holding them up and trying to dissuade them, and make them turn back. The Magi are not dissuaded. They probably warned Joseph and Mary of danger, as they flee to Egypt as soon as the Magi have left.
This is the chronology around the birth of Jesus given by Colin Humphreys:
Birth of Jesus in Bethlehem (13-27th April 5 BC, but I think 6th April 5 BC)
Visit of the shepherds
Circumcision on the 8th day
Presentation in the Temple 40 days after birth
Visit of the Magi after this
Flight to Egypt after the Magi leave
Death of Herod in 4 BC
Return from Egypt in 3 BC