According to the legend, the festival marks the auspicious day of the birth of Lord Ganesha. The story goes as follows- Lord Shiva, the Hindu God of resolution, was away from Kailash due to some work. As Parvati was alone at home, she felt the necessity of some one to guard the door to her house while she took bath. When she did not get any one, she conceived of the idea of creating a son who could guard her. She then created Ganesha out of her sandalwood paste and breathed life into the idol. She then asked him to stand on the gate and do not let any body enter until she came out. Unfortunately, Shiva returned home in the meantime. As, Ganesha did recognize him, he stopped Shiva from entering as per his mother's advice. This badly enraged Lord Shiva, who cut off Ganesha's head by his trident. When Parvati saw beheaded Ganesha, took on the form of the Goddess Kali and threatened to destruct all the three worlds.
The earth, the heaven, the nether world, all was shaken and every body ran to Shiva for solution. In order to appease Lord Parvati and save the world from destruction, Lord Shiva sent out his followers to find a child whose mother is facing another direction in negligence, cut off his head and bring it quickly. The first such child that came in the eyes of the Shiva followers was an elephant, so they brought the head of this elephant and Shiva placed it on the trunk of Parvati's son and gave life into him. Parvati was the overwhelmed with happiness and embraced her son. They named her Ganesha i.e the Lord of all Ganas (followers).
Though the festival is being celebrated since times immemorial, the present kind of celebrations of Ganesha Chaturthi came in fashion in 1893, Lokmanya Tilak, an Indian freedom fighter and social reformer reshaped the annual Ganesh festival from a private family celebration into a community event. The day was conceived to be the National Festival in order to bridge the gap between the Brahmins and the non-Brahmins in the society. Tilak chose this festival for this purpose because Lord Ganesh was considered to be the ' God of Everyman'. It then served as a meeting ground for people of all community and religion on a public platform. Since then the festival has served its cause of existence. Even now people irrespective of caste and community barriers celebrate this festival with great joy.