According to the legends, one day Mata Mata Parvati, instructed Lord Shiva’s attendant Nandi not to let anyone in while she was taking a bath. A little later Lord Shiva arrived wishing to enter. Nandi was in a dilemma as how to stop his master. Lord Shiva entered Mata Parvati was not ready to receive him. She was upset and wondered why Nandi had not obeyed her command. She complained to Lord Shiva but Lord Shiva did not take the matter too seriously. He was amused to hear that Mata Parvati had asked Nandi to stop him from entering his own home. Mata Parvati was annoyed. She shared her feelings with her friends. They teased Mata Parvati by saying that she had no attendant of her own. They all considered Lord Shiva their true master. One of Mata Parvati’s friends came up with the idea to create a person who would owe his first allegiance to Mata Parvati and not to Lord Shiva. Once, while his mother Mata Parvati wanted to take a bath, there were no attendants around to guard her and stop anyone from accidentally entering the house. So Mata Parvati gathered the turmeric/saffron paste, from her own body and created a boy, and infused life into it, and thus Ganesha was born. The boy was handsome and strong. “You are my son, my very own son, I do not have anyone else to call my very own” said Mata Parvati. Then Mata Parvati gave the boy a staff and asked him to guard the door, “Do not to allow anyone to enter without my permission.”
A little later Lord Shiva arrived and wondered who the boy could be and why was he there. His attendants did not know either. As Lord Shiva approached the door, the boy stopped him. Lord Shiva tried to explain to the boy that he was Mata Parvati’s husband and he had the right to enter without asking anyone. The boy said without hesitation, “Halt, no one enters these halls without my mother’s permission.” When Lord Shiva ignored him, the boy hit him with his staff. Lord Shiva was furious. He tried to fight the young boy to realize that he was no ordinary boy. Lord Shiva asked his attendants to capture the boy but single-handedly, the boy defeated all of them. News reached Mata Parvati through her friends and she thought, “Lord Shiva is after all my husband.” But she instantly argued, “But why should he try to force himself in without giving respect to my privacy?” So she firmly conveyed her feelings to her friend, and she took the message to the boy, “Mata Parvati has given definite instruction as not to allow anyone to enter the palace. The boy declared, “I am the son of Mata Parvati. I will give my life to carry out my mother’s orders. No one can enter the palace without my mother’s permission.”
The messenger returned to Lord Shiva and humbly informed him what the boy had said. Lord Shiva’s pride was hurt. Lord Shiva was so angry that he sent his entire army to capture the boy. Mata Parvati called for her other powers, Kali and Durga. She asked them to stand beside her son. Lord Shiva’s army lost the battle and the attendants ran for their lives. Lord Shiva then called Vishnu to join him in defeating the small boy. This was not a fair fight. While the boy was engaged in fighting with Vishnu, Lord Shiva threw his Trident and beheaded the boy. After the head rolled off, Lord Shiva realized his mistake. When Mata Parvati heard of the unfair fight she decided to destroy the world. Brahma humbly approached Mata Parvati, seeking for mercy to save the world. Mata Parvati agreed on two conditions, “My son must regain his life and he shall be worshipped before any of the other gods.” By that time Lord Shiva had calmed down and apologized for his rash behavior. He agreed to bring the boy back to life.
Lord Shiva approached Lord Brahma who suggested that he replace Ganesha’s head with the first living being that came his way which lay with its head facing north. Lord Shiva then sent his Gana to find and take the head of whatever creature they happened to find asleep with its head facing north. They found a dying elephant which slept in this manner, and after its death took its head. The head was then fitted to the body of the boy and Lord Brahma sprinkled water on it. The boy came to life with an elephant’s head on his shoulder. From then on, he was called Ganesha, head of the celestial armies, and was to be worshipped by everyone before beginning any activity Mata Parvati embraced her son with joy. She then turned to Brahma to fulfill her second condition. Indra and the other gods brought Lord Shiva to Mata Parvati. Lord Shiva apologized for his arrogance and declared “Hence on, this valiant boy will be my son. He will be respected as any other God and will be worshiped before any other God. He will be called Ganesha, the chief of my Ganas or attendants, and also Vigneshwar, the remover of all obstacles.”