The Devas, convinced that their good actions were being met with obstacles while the evil acts of the Asuras were meeting with success, requested Lord Shiva to place obstacles in the path of the Asuras. Shiva agreed and looked at his consort, Mother Uma whereupon an effulgent form of the child Lord Ganesha manifested.
Lord Shiva blessed him saying he would be worshipped first by everyone, to gain success in any positive endeavour, that he would destroy the evil-minded and fulfil the desires of the good-minded.
The Devas and Asuras represent our own noble and ignoble tendencies. Lord Ganesha blesses us with an altar at which we can invoke the required strength, sensitivity and discrimination to overcome the obstacles both within and without and places hurdles if we stray to the wrong path.