As we all know that Lord Ganesha is worshiped before any Puja. There are many versions of the story as to why this happens that we keep hearing. Let us go through the three most common versions today on the occasion of Ganesh Chathurthi.
As Goddess Parvati was taking bath, Lord Shiva returned home but was stopped from entering the palace by Lord Ganesha who wanted to protect the promise he had made to his mother Parvati.
This angered Lord Shiva and since he was unaware that Lord Ganesha was Devi Parvati’s son, Mahadev Shiv attacked Ganesh and destroyed his head. Later, when Goddess Parvati realized what had happened, she was angry and threatened to destroy the world. She declared that she would stop her rampage only if Ganesh was brought back to life and then declared as equivalent to the foremost Gods.
Realizing his mistake, Lord Shiva offered to correct his mistake and requested Lord Vishnu to fetch the head of the first living creature facing in the north direction that the latter spotted. This happened to be an Elephant.
Lord Ganesha was brought back to life with an Elephant head by Lord Shiva and was declared to be the foremost Hindu God who was to be worshiped before all other Gods. As a result, Lord Ganesha is worshiped at the beginning of every Puja till date.
This version of the story talks about the demon Gajasura (Elephant headed demon) who after painful penance to Lord Shiva was granted an armor that nobody in the world could destroy. Gajasura went on a rampage torturing the residents of the planet and slowly beginning to challenge the Gods.
He also continued with his penance to Lord Shiva who once again offered to grant him a wish. This time, Gajasura decided to play a trick on Lord Shiva and requested the latter to take residence in his stomach. Unable to see through Gajasura’s trickery, Lord Shiva agreed.
When days later, Parvati Devi was unable to track her husband, she approached Lord Vishnu for help. Lord Vishnu being omniscient knew what Gajasura had done and so he disguised himself as a comedian with Nandi.
Lord Vishnu, in his disguise, and Nandi approached Gajasura and performed a comedy play for the latter. Pleased by the entertainment, Gajasura looked at Lord Vishnu in disguise and offered to grant any wish that the latter asked for.
Taking advantage of this, Lord Vishnu asked Gajasura to free Lord Shiva from his stomach. He agreed to free Lord Shiva by tearing his stomach but in return asked to grant him another wish. He requested that he be remembered by all residents of the earth for eternity and that they all worship his face.
To grant his wish, Lord Shiva called his son Ganesh and replaced his head with that of Gajasura. Further, Lord Shiva declared that Ganesh be worshiped before all other Hindu Gods thus ensuring that Gajasura’s name continued to be remembered by one and all for eternity.
As a result, Lord Ganesha is worshiped before every puja as a fulfillment of Gajasura’s wish to Lord Shiva.
Shiva and Parvati wanted a race between their two children Ganesh and Kartikeya. The race was to go around the world thrice and bath in all sacred rivers. The winner would be made head to all ganas. Kartikeya started on his mount (the peacock) but Ganesh knew he would not win with his mount (the mouse). So he instead circled his parents thrice and earned the equal effect of circling the world thrice.
So Ganesh won and he was made head of all ganas (Ganapati), as a reward for his intelligence he was also made head of all obstacles (Vigneshwara).