Lord Ganesh is the son of Lord Shiva and goddess Parvathi. The story of creation of ganesh is a very fascinating one.
Long time ago when Lord Shiva, was away fighting for the gods, the lady of the house, goddess Parvathi was alone at home. On one occasion, she needed someone to guard the house when she was going for a bath. Unable to think of an alternative, she used her powers to create a son, Ganesh. She instructed Ganesh to keep strict vigil on the entrance to the house and not to allow anyone into the house. Ganesh agreed and stayed on the strictest of strict vigils.
In the meantime Lord Shiva returned happy after a glorious victory for the gods, only to be stopped at the entrance by Ganesh. Ganesh, acting on Parvathi's orders verbatim, did not allow Shiva to enter the house. Lord Shiva was enraged beyond control and in a fit of rage slashed the head of Ganesh. In the meantime Parvathi came out from her bath and was aghast at the scene. She was very angry at her lordship for what had happened and explained him the situation.