There was once a devotee of Bhagwan Shiv named Gajasur, the elephant headed demon. He performed great penance to appease Bhagwan Shiv. Bhagwan Shiv was pleased with his devotion and asked him for a boon. Wanting all the presence of Bhagwan Shiv just for himself and none others, Gajasur asks Bhagwan Shiv to be embedded in his stomach forever. Bhagwan Shiv is surprised at his wish and mentions that Almighty belongs to everyone and this greed would cost him dearly. But Gajasur doesn’t pay heed to his words. Bhagwan Shiv agrees and enters his stomach.
Meanwhile, the entire world falls in anarchy because of the absence of Bhagwan Shiv. All the Devas and Bhagwan Vishnu request Bhagwathi Parvathi to meditate upon her swami and bring him back. For the same, Bhagwathi Parvathi goes for a ritual bath and while taking bath prepares a small image of a boy with sandalwood paste and gives him life. He bows to her and Bhagwathi Parvathi asks him to guard the door and let none enter.
Meanwhile, Bhagwan Vishnu, Brahmaji and all the other Devas go to Gajasur and ask him to release Bhagwan Shiv, for which he refuses. The Devas start singing praises of Bhagwan Shiv in appeal and Bhagwan Shiv breaks open Gajasur’s stomach and comes out. Although Gajasur is not dead, he becomes upset that Bhagwan Shiv has broken his boon, but Bhagwan Shiv mentiosn that he had already mentioned him about the consequences of being greedy. But as Gajaur was his ardent devotee, he mentions that he won’t let his boon go waste and asks him to wait upon his call
When Bhagwan Shiv returns to Mount Kailash, he finds a young boy guarding the gates who stops him. Inspite of repeated request of Bhagwan Shiv, the boy doesn’t allow Bhagwan Shiv to enter. Enraged, Bhagwan Shiv cuts the boy’s head. Bhagwathi Parvathi comes out shocked and upset while revealing to Bhagwan Shiv that the young boy was their son. Bhagwan Vishnu, Brahma ji, and all the Devas comes rushing and mention that they would bring back the boy to life.
Remembering his promise to Gajasur, Bhagwan Shiv sends Nandi to severe the head of anybody which was lying towards the north direction. Nandi and the Ganas go in all directions, find Gajasur lying with his head to the North Direction chanting Bhagwan Shiv’s name. They severe his head and get him to Bhagwan Shiv. Bhagwan Shiv requests Brahma ji to replace the elephant‘s head to the body of his son and give life. The boy comes back to life and bows to his parents Bhagwan Shiv and Bhagawathi Parvathi.
As the young boy was replaced with the head of an elephant, he was named as Gajanan or Ganesh, which means the elephant headed one. The elephant is a symbol of intelligence, wisdom and prosperity. Bhagwan Shiv and all the Devas give Shri Ganesh the boon that he would be the wisest among all and everybody would start any ritual or auspicious thing only after offering worship to him and be blessed with prosperity and success
Thus, Bhagwan Shiv fulfils the boon of his devotee Gajasur by granting Gajasur his presence all the time, and also brings back his sin to life fulfilling the wish of Bhagwathi Parvathi and giving brith to the elephant heade God Shri Ganesh.