Some sources say it was traders others say it was also invaded. They say the hindus fled to bali, why not just finish them off? Why let them stay for hundreds of years? And yet buddhism plays small but significant role as well. There are some buddhist temples all the way up in nothern thailand that utilize balinesian styles so clearly balinesian buddhism was also immensely relevant itself. Theres so much to unpack.... i think i need an answer from the hindu/muslim perspective and then a different one for buddhism if possible. I live in Thailand so the buddhism angle is a very curious one.
This answer by an unknown author really goes into detail on how and why the people of Indonesia converted. https://www.reddit.com/r/AskHistorians/comments/5o8avu/how_did_indonesia_and_malaysia_become/?utm_source=share&utm_medium=ios_app&utm_name=iossmf
The gist of it is rulers had a wide variety of economic, political, social and philosophical reasons to convert. They then often with varying levels of success pushed for their population to convert. Sufi orders were also key in converting much of the populace of the area, successfully harmonising Islam with many of the islanders traditional beliefs, which were eclectic and often not exclusive to one religion. Specifically many parts of the population viewed organised religion as basically a particularly effective form of magic, something which many Sufi teachers picked up on and used to generate enthusiasm for Islam.