It was established by Adiwijaya or Jaka Tingkir, Lord of Boyolali, after a civil war and was a successor to Sultanate of Demak.
The two managed to defeat and kill Arya Penangsang and were thus awarded a fief in a forest called Alas Mentaok, now Kotagede, on which they founded their base for the future capital of Mataram Kingdom.
Adiwijaya's rule was supposed to be succeeded by this weak-minded heir, but a rebellion by a vassal named Ario Pangiri forced the prince to seek asylum from his childhood friend Sutawijaya.
Pledged to help, Sutawijaya gathered his army defeated Ario Pangiri, and seized the Pajang Palace.
When Majapahit was led by Brawijaya V [id] (the last king written in the babad texts), the name Pengging reappeared.
For his services, Jaka Sengara was appointed by Brawijaya [id] as the Pengging regent (bupati) and married Retno Ayu Pembayun.
According to the babad scripts, Andayaningrat died at the hands of Sunan Ngudung [id] during the war between the Majapahit Empire and the Demak Sultanate.
Jaka Tingkir's brilliant achievements in the army made him appointed as Trenggana's son-in-law and became the regent (bupati) of Pajang with the title Adiwijaya.
With the support of Ratu Kalinyamat (the regent (bupati) of Jepara and daughter of Trenggana), Adiwijaya and his followers succeeded in defeating Arya Penangsang.