As you point out, the Magi came from the east, out of Persia or southern Arabia, towards Jerusalem, in the west. Matthew2:1-2 confirms that they saw his star in the east (from whence they came). Celestial bodies move from east to west (due to the earth’s rotation), yet this heavenly body apparently led them west, to Jerusalem.
The ESV Study Bible Notes suggest that the star was not a natural phenomenon (e.g., a comet, supernova, or conjunction of planets) but was supernatural. Given the distance to be covered from Babylon to Jerusalem (800 miles via the main trade route), and the likely size of the caravan (attendants and guards) it would have taken 40 days or so to make the journey.
The KJV translation that the Magi “saw his star in the east,” suggests they saw the star where they were in Babylon, which is to the east of Jerusalem. The night sky was well known to people living 2,000 years ago but it seems this star was new – that it had never before been seen and charted. Did they then follow this object for 800 miles, heading west towards Jerusalem, travelling at night? The Bible does not say.
However, the real conundrum is that once they got to Jerusalem, this “star” had seemingly disappeared. It was Herod who instructed them to go to Bethlehem, which is a village about five miles south of Jerusalem.
“After they had heard the king, they went on their way, and the star they had seen in the east went ahead of them until it stopped over the place where the child was. When they saw the star, they were overjoyed” (Matthew 2:9-10).
After the magi got to Jerusalem the “star” had apparently disappeared, then reappeared and led them from Jerusalem SOUTH to Bethlehem where it STOPPED, directly over the place where the child was. No natural stellar phenomenon can do that.
The Greek word ‘aster’ is translated as star – but it does not always literally mean a star. It can also mean “luminous body like a star.” This meaning refers specifically to Matthew 2:2, 7, 9, and 10.
Perhaps, instead of thinking about a literal star, we should acknowledge that what the Magi initially saw, what led them first towards Jerusalem and then specifically moved south and stood over the place where Jesus was in Nazareth, was no natural stellar event, but was a phenomenon orchestrated by God. The article in the link below is worth reading. It is copyright protected so I can’t cut and paste, but the essence is that this was no natural stellar phenomenon.
Waging Wisdom Star of Bethlehem - 21 December 2018 – Charles Strohmer – Re-enchanting the Star of Bethlehem: https://wagingwisdom.com/2018/12/21/re-enchanting-the-star-of-bethlehem/