In the hinduism, it's the son of Shiva. The legend says that shiva went out to meditate for a few years leaving behind his baby with parvati, his wife, and when he come back he saw his baby grown up. He became jelous of his son so he killed him. After that he felt guilty and he put a head of a dead elephant in the neck of ganesha so he came back to live again.
sri Ganesha om jay! Ganesha pahiman, pahiman ganesha