MATTHEW & THE MAGI
Matthew's account references 3 magi, rather than 3 kings. Specifically, all we know from Matthew's account appears in the first twelve verses of chapter 2.
Matthew's references to these three 'magi' is commonly accepted to be a reference to Zoroastrian priests from the region of Media. The religion we call 'Zoroastrianism' knew itself as Mazda-yasna meaning "devotion (yasna) to the one God Ahura-Mazda" and relates to an earlier pagan worship the House of Israel engaged in prior to captivity.
The magi first appear in history in the seventh century b.c. as a people within the Median nation in eastern Mesopotamia where the pagan House of Israel was taken into captivity ([2 Kings 18:11] and [2 Kings 17:6]).
MAGI & ISRAELITE TRADITION
Accordingly, scholars have proposed the magi to have been Semitic paganized Israelites or their neighbours familiar with their beliefs, and so would have been familiar with both Molech (Malkam) and YHWH worship.
So they would have been familiar with both Israelite heterodox and orthodox tradition. The magi became skilled in astronomy and astrology (which were indistinguishable) and they possessed a sacrificial system that strongly resembles the Mosaic system Israel also possessed.
Traditional scholarship treated Molech as a name. Lack of evidence of this however has more recent scholarship disputing this instead seeing it not as a proper name but a title. Biblical Hebrew מלך (mlk) stands for מֶלֶךְ melek "king" (Akkadian malku) vocalized as מֹלֶךְ mōlek. (Strong's Concordance H4427, H4428, H4432)
MOLECH WORSHIP & ZOROASTRIANISM
In Molech worship fire represented purity [Lev 18:21][2 Kings 23:10] and so Molech worship was a type of ritual purity worship involving fire which YHWH prohibited. Likewise, in Zoroastrianism, fire was seen as the supreme symbol of purity, and sacred fires were maintained in Fire Temples (Agiaries).
These fires represent the light of God (Ahura Mazda) as well as the illuminated mind, and were never extinguished. No Zoroastrian ritual or ceremony was ever performed without the presence of a sacred fire since their primary altar burned the perpetual flame they claimed descended from heaven.
Therefore 'stars' were seen as eternal 'fires or lights' and the source of all purity. Clearly, this would have had significance with respect to eternal kingship and purity since it would have been from these 'eternal flames' in the sky the eternal pure king should have descended.
CONCLUSION
Even so the Israelites had been prohibited from worshipping the stars directly [Deut 4:19]. However the Israelite taken to the city of the Medes and to Babylon had already strayed from YHWH worship Orthodoxy [Acts 7:43].
Even so it's not hard to see that if a star appeared which would have heralded the coming of a pure king (to the Magi) they would have been willing to seek him out based upon their understanding of the significance of stars.
FINALLY
(Don't shoot the messenger. I'm simply conveying what the Magi thought, according to what is known of Zoroastrianism, and what the bible says of Molech worship. I'm not advocating their beliefs. You asked why star=ruler and why star=messiah for Israelites. It turns out to be the same thing for different reasons. Yes! I see great irony in pagan magi seeking Christ due to pagan belief but hey - God caused them to give Yeshua and family very expensive gifts (representing 'King', 'Prophet' and 'Priest') that likely would have provided the family a great income for years)