They’re in a binary orbit where they each orbit each other like a yin yang. This actually happens in real life too, where for example the closest solar system to us, Alpha Centauri contains two stars called Rigil Kentaurus and Toliman, which orbit each other. This is actually even pretty commonplace in the galaxy, and we’ve even discovered real life exoplanets just like the fictional Star Wars planet Tatooine that orbit two stars.
What doesn’t make sense in Minecraft though is how the Moon somehow has roughly the same amount of mass as the Sun to explain the equal mass orbit, even though in real life the mass discrepancy between the Sun and the Moon is quite literally astronomical.
Sorry for being all science-y but that’s just my take on the whole thing