As per a Vedic myth, Daksha Prajapati had given 27 of his daughters in marriage to Chandra (the moon god). Chandra was known for his good looks and virility. But Chandra amongst all the wives preferred Rohini, which angered the other sisters, who complained to their father about this partiality.
Daksha Prajapati cursed Chandra with a degenerative disease, which led him to lose his lustre and thus Chandra started to wane. Chandra was worried and on the advice of Lord Brahma, prayed to Shiva, who allowed him to take refuge in his locks and gain his potency back.
Later, the curse was reduced to a temporary state, and from that day onwards, Chandra, the moon, waxes when it approaches Rohini and wanes when it moves away from her. On the full moon day, Chandra attains his full potency, and then onwards, it loses its potency to the new moon night, when he has no wife by his side and on the previous day, when he is just a crescent, he takes refuge on Shiva’s locks. The day Chandra, takes refuge on Shiva’s locks, Lord Shiva is known as Chedrashekhar!
Another myth has its origin in the ravenous appetite of Lord Ganesha. It so happened that once Ganesha had an overdose of his favourite sweet, modaks (sweet rice balls), till the point of feeling extremely uncomfortable. He then decided to out in the open air. While was in the jungle, a snake crossed his path, which scared his vahana, the mouse, who backed out a bit, toppling Ganesha. On falling, Ganesha’s big tummy burst open and all the modaks rolled out. Ganesha ran after them, collected all of them and stuffed them back, and tied his tummy with the help of the snake Vasuki.
All this was being witnessed by Moon and his wives, and they all burst out laughing! Ganesha felt very insulted and cursed the Moon god, to disappear forever. Shiva realised that the disappearance of Moon could cause cosmic dis-balance, so he intervened. He made Moon god apologise to Ganesha and in turn asked Ganesha to reduce this curse. Ganesha then reduced the curse to slowly diminishing and then disappearing for a day, and then come back to his original size back, and then start the diminishing act again. This cycle would continue forever, so that people are reminded of the curse and also not to make fun of the Lord!