The Legend of Lord Ganesha and Durasadan is discussed in the Mahapuranas and Upapuranas, which are ancient Hindu religious texts. Lord Ganesha, also known as Vighneshvara and Ganapati, is the son of Lord Shiva and Goddess Parvati and the brother of Lord Kartikeya. He is worshipped before the beginning of any religious ritual or new venture. Ganesha (Vinayaka) is the God of Wisdom, the Remover of Obstacles and Lord of Beginnings. The tale states that Lord Shiva and Lord Vishnu, in the avatar of Mohini, annihilated the asura (demon) Bhasmasura, also known as Basmasuran. As a result of this, he demon Durasadan, the son of Bhasmasura, became very upset and infuriated. He did intense meditation or tapas in worship of Lord Shiva. Eventually Shiva became pleased with his devotion and granted him boons that Durasadan asura should never die and will be able to control of the deities or Devas. As a result of this, the demon created utmost chaos in heaven and earth.
All the deities ran from their abodes in Swarga Loka or heaven. Even Lord Vishnu escaped from Vaikuntha and Lord Brahma left Brahma Loka and took shelter in Kashi, along with the other gods. Kashi was then ruler by Viswanathar. Later Durasadan asura went to Kashi in search of the devas, but all the deities and gods had escaped to Kedaram by then. The gods decided to wait for the proper time to eliminate the demon. Then the gods and deities prayed to Lord Shiva for help and an incarnation of Lord Ganesha appeared out of the face of Goddess Parvati. This avatar of the elephant headed deity comprised of ten hands, five heads and Jada magudam with moon. He was named as Vakradhundar by Parvati, also known as Goddess Uma. She presented him with a Simha (lion) as his mount or vahana.
Thus a fierce battle commenced between Lord Vakradhundar and the asura Durasadan. Eventually Ganesha took a gigantic form or Viswa Roopam and put his divine feet upon the head of Durasadan. As a consequence, all wickedness and sinful thoughts escaped from the demon`s mind. Eventually Lord Ganesha appointed him the task of eliminating all evil and suffering from Kashi. Durasadan was placed at the feet of Vakradhundar performing his duties.