Once upon a time, Goddess Parvati instructed Nandi, one of Shiva’s Ganas (attendants), to stand outside her home as she went in for a bath. Her instructions were that nobody should be allowed to enter the home. After a while, Lord Shiva approached the house. Nandi was in a fix, and did not stop the lord of the house from entering. As Shiva entered the home, Parvatiji was startled and annoyed that Nandi did not stop Shiva despite her instructions. She decided to create her own Gana who would obey her instructions.
Parvatiji created an image of a boy from the turmeric paste applied on her body during the bath. Parvatiji infused life into the form. Parvatiji instructed Ganesh not to allow anyone to enter the house without her permission. The boy obeyed his mother, and did exactly as she told. When Lord Shiva tried to enter the house, Ganesha did not allow Lord Shiva to enter the house. Lord Shiva was perplexed, and sent his Ganas to convince the boy to allow the Lord to enter. Ganesha consulted his mother, but Parvatiji was firm in her decision that nobody should enter the house. Ganesha told the ganas of Lord Shiva that it was their duty to obey Lord Shiva, while it was his duty to obey his mother Parvatiji.
In the battle that followed, the young boy single handedly defeated the entire army of Lord Shiva’s ganas. Realising that this is no ordinary boy, and was his own son, Lord Shiva came in with Lord Vishnu, Brahma and all the Gods to try to dissuade the boy. When dissuasion did not work, the battle began. The result was a foregone conclusion, but the boy did put up a valiant fight thanks to his focus on devotion and obeyance of his mother’s command. Lord Shiva’s trishul flung the boy’s head far away.
Parvatiji was furious. She summoned all the Shaktis, and they began devouring Lord Shiva’s Ganas. The Gods went to Goddess Parvati, and asked her for forgiveness and peace. Goddess Parvati insisted that the boy be brought back to life. Shiva approached Brahma, the creator. On his suggestion, they found a dying baby elephant that slept with its head facing north. Just after its death, they removed the head of the baby elephant, and transplanted it on the body of the boy. Lord Brahma blessed the boy with life. The boy now had the body of a human, with the head of an elephant. Lord Shiva proclaimed that his son would be the chief of all the Ganas – Ganesha.