As a student of Sunan Kalijaga, Sunan Bayat lived during the earliest period of the Islamization of Java in the 16th century. He was the son of Ki Ageng Pandanaran I, the first Regent of Semarang. After Ki Ageng Pandanaran I died, his son, Prince Mangkubumi, replaced him as the second regent of Semarang. According to H.J. de Graaf and Th. Pigeaud in the First Islamic Kingdoms in Java, it is said that he initially ran the government well and always obeyed the teachings of Islam like his late father. However, over time there was a change. He who was once very good turned into an arrogant figure, did not want to worship, and looked down on the poor (Balar Jateng and Cermin Kudus, 2006: 181). Government duties were often neglected, as well as the maintenance of Islamic boarding schools and places of worship.
Knowing this, the Sultan of Demak sent Sunan Kalijaga to make him aware. There are variations of the story according to several chronicles about how Sunan Kalijaga made the regent aware. The Babad tells the story of Sunan Kalijaga disguised himself as a grass cutter who applied for work at Ki Ageng Pandanaran's house. At that time, Sunan Kalijaga witnessed how Ki Ageng Pandanaran was actually piling up rice, even though the people were in the midst of famine. When, Sunan Kalijaga, who was in disguise, also asked Ki Ageng Pandanaran for rice, he curtly replied that what he brought was not rice, but sand. Instantly, the pile of rice turned into sand. When he realized his mistake, Ki Ageng Pandanaran begged the grass cutter to turn the sand back into rice. After everything was done, he realized that the figure he thought was a grass cutter was actually his own teacher, Sunan Kalijaga. Finally, the regent realized his negligence, and decided to resign from his worldly position and hand over power to Semarang to his younger brother.
Prince Mangkubumi then moved south. Accompanied by his loyal wife, he passed through areas such as Salatiga, Boyolali, Mojosongo, Sela Gringging, and Wedi. According to oral tradition that developed in society, these names are always associated with the figure of Prince Mangkubumi. In the new region, he settled in an area called Tembayat, while building a school on Mount Jabalkat. In this region, he became a persistent spreader of Islam. After he died, he was also buried at the peak of Mount Tembayat. From this name, he is better known as Sunan Bayat.