Legend From Shiv Purana
The most popular legend associated with Lord Ganesha can be found in the Shiv Purana. It says that Lord Ganapati was created out of the dough that Goddess Parvati used for her bath. The Goddess wanted a door-keeper, to prevent the coming of any visitors when she took a bath. So, she created a doll from the dough and breathed life into him. The day she did this came to be known as the birthday of Lord Ganesha, which we today celebrate as Ganesh Chaturthi.
On day, while Goddess Parvati was taking her bath, Lord Shiva happened to visit her. Ganesha did not know him, so he did not allow the Lord to enter the house. This made Lord Shiva angry and he beheaded Ganesha. Later, when he came to know the truth, he fixed the head of an elephant in place of Ganesha’s head. With this, the appearance of Lord Ganesha changed and he came to have the head of an elephant.
Legend From Skanda Purana
There is yet another popular legend associated with Ganesh Chaturthi, arising from Skanda Purana. It goes that once Ganesha was invited for a feast in Chandralok. He ate many Ladoos and later, as he got up to walk after the meal, he could not balance himself, because of his huge stomach, and slipped. His stomach burst and all the laddoos came rolling out. Seeing this, the moon could not control himself and began laughing. Ganesha got angry and cursed the moon that it will vanish from the universe.
Because of moon’s absence, the whole world began to wane. The gods asked Lord Shiva to get Ganesha to change his mind. The moon also apologized for his misbehavior. Finally, Ganesha modified his curse saying that the moon would be invisible on only one day of a month and would be partially seen on Ganesha Chaturthi. He also added that anyone who watches moon on Ganesha Chaturthi would face a false accusation. This is the reason why, even today, it is considered inauspicious to look at the moon on Ganesh Chaturthi.