The Hindu god Ganesh was the son of Lord Shiva and his consort Parvati, who both have human heads. So how then did their child come to have the head of an elephant with the body of a boy? Because the gods were trying to appease one very upset goddess! Here’s the story:
“A more popular legend deals with the birth of Ganesha to Parvati. Once while Parvati was going for her bath, she rubbed off the dust and oil from her body and out of it created the figure of a young boy. She infused life into the figure and told him he was her son and should guard the entrance when she went down to bathe.
Soon after, Shiva came to see Parvati but the young boy blocked his way and would not let him in. Shiva, unaware that this lad was his son, became furious and in great anger fought with the boy whose head got severed from his body in the ensuing battle.
Parvati, returning from her bath, saw her headless son and threatened, as Shakti, to destroy the heavens and the earth, so great was her sorrow.
The gods and Shiva pacified her and the latter sent out his ganas, or hordes, to bring the head of the first living being with his head towards the north (the auspicious direction associated with wisdom). They did so and the first living creature they found sleeping with its head to the north was an elephant.
They brought the head of this animal and Shiva placed it on the trunk of Parvati's son and breathed life into him. Parvati was overjoyed and embraced her son, the elephant-headed boy whom Shiva named Ganesha, the lord of his ganas.”
Source of the story in quotes: www.samachachar.com