If you have a couple of minutes to spare, this earlier response by u/PangeranDipanagara briefly covers the basics.
How did Indonesia and Malaysia become majority-Muslim when they were once dominated by Hindu and Buddhist kingdoms?