Ganesh is a Hindu God, here is the story of how he came to be and why he is know as the gate keeper.
Who is the boy who got an elephant's head? His name is Ganesha and he lived in India long, long ago. He is also called Ganapati. Actually, he still lives, because he is considered by the Hindus as one of the Immortals. His is a fanciful story, full of twists and turns and "maybe 'twas and maybe 'twasn't"; but let us follow the tale as best we can, and enjoy!
The boy was born to Parvati, also known as the Divine Mother, the wife of Shiva. She thought him a most beautiful baby (for at that time he had a normal head) and he grew to be the darling of her heart in any case, and a very wise boy. In fact, even today he is looked upon as Wisdom itself, among other things. (And you know how smart elephants are!)
One day his mother brought out her most precious necklace of sparkling jewels. She wanted to test her two sons and said she would give the necklace as prize to the one who went around the whole universe and came back first. The brother of Ganesha darted out at once to begin the long journey. But Ganesha solemnly walked in a circle around his mother. Then he asked for the necklace. "What is that?" Parvati asked, "What do you mean?" "Mother," replied Ganesha, "I know that you are the Divine Mother herself, that the whole universe is contained within your body." Parvati was highly pleased at her son's spiritual insight. After many days the brother returned. Who do you think had got the necklace? Yes, Ganesha, the truly wise, and he put it around his neck.
However, all this was after he got the head of an elephant. We have to go back. It is said that when all the gods came to honor Parvati and admire her child, one of them (the one which we in the West call Saturn) refused to look at the boy. His mother was very peeved about this. Other gods chided him, but you see, he knew that one glance from his powerful eyes would burn the child's head to ashes. Still Parvati was insisting that he give the baby his admiring glance. At last, yielding to what we today might call "peer pressure," Saturn cast his eyes on the boyand sure enough, his head was immediately burnt to ashes. Of course his mother began to weep and wail (although it was mostly her fault) but the god Vishnu, who always wants to preserve things, ran quickly and found a freshly-killed baby elephant brought its head and put it on Ganesha's neck. Growing up like this, he became "the one who removes obstacles," watches over the beginnings of things such as books, performances, building of a house, weddings etc. So in India when people begin those things, they appeal to the immortal Ganesha to give them a good start. Big as he is, he weighs very little, and this makes it possible for him to ride on a Rat. If you want to know why he rides on a rat, you must understand that his rat can get into all the small places where Ganesha cannot go; this helps him in his work of solving and removing difficulties.
Ganesha is worshiped all over Southern India. Statues and paintings show him as short, pot-bellied, with four arms and of course two tusks; but, one of the tusks is always shown broken off. The reason for this is that he was protecting the home when his father Shiva was inside. An enemy of his father's came along looking for his foe and found only Ganesha, guarding the door. Ganesha skewered the warrior and whirled him around on one his tusks! And the fellow was so humiliated and angry that he threw his hand-axe at the boy, breaking off the tusk. Along with all the other things, he stands for purity. He vowed never to marry. The great author Vyasa thought so highly of him and his power of memory ("an elephant never forgets") that he persuaded Ganesha to write down at his dictation the longest poem in the world, the epic Mahabharata.