In Hindu mythology Lord Shiva commands the respect of all other Gods. He got into a kind of problem. It all started with a boon He grants to a demon in appreciation his deep meditation chanting the name of Lord Shiva. The boon was a request by the demon wanting Lord Shiva to enter his body. Lord Shiva granting the boon enters the body of the demon and that creates a panic in Kailash where He lives with his better of Parvathi. The demon mentioned here is named Gajasura and who has a peculiar appearance similar to an elephant.
A few days pass by before goddess Parvathi’s learning that Lord Shiva was imprisoned in the Gajasura’s body. Later she approaches Lord Vishnu to bail Lord Shiva out of the situation. Lord Vishnu disguised himself as street player and set out along with a Nandi (Shiva’s bull carrier). The Nandi performs a dance in the demon Gajasura’s kingdom. Pleased by Nandi’s performance Gajasura grants a wish to the street player without knowing the street player’s background. As if waiting for the right Lord Vishnu asks the demon to release Lord Shiva imprisoned in his stomach. The demon ultimately realizes the ploy and agrees to release Lord Shiva but with a request. He prayed that he must remain immortal in the minds of the people. Thus Lord Shiva severes Gajasura’s head relieves him from the cycle of birth and death. Lord Shiva carries the head of Gajasura on his way back to Kailash. During this time an interesting thing happens at Kailash.
Knowing the happy news, Goddess Parvathi wanted to prepare herself to welcome Lord Shiva. She creates a child of her own with dough and names it Vinayak. Goddess Parvathy instructs the child to guard the house while she is taking bath and prevent anyone from entering the palace. During this time Lord Shiva reaches the palace and was surprised to see Vinayak preventing his entry. Since Vinayak never saw Lord Shiva earlier he was adamant in implementing his mother’s instructions, thus preventing any attempt by Lord Shiva. This further infuriated Lord Shiva who enters the palace after beheading the boy.
Unaware of all this goddess Parvathi welcomes Lord Shiva full of joy. In the conversation Lord Shiva narrates the incidence at the palace gate which shocks Parvathi. She faints on this and pleads Lord Shiva to give life to her child. Came handy of Gajasura’s head Lord Shiva carried all the way. He places the head on the child’s torso and gives life. So the boy with an elephant head is named as Ganesha who Lord Shiva blesses with a boon that he would be worshipped by the people.