An interesting story in the Skanda Purana mentions why
Ganesha is the Lord of Obstacles? – One who removes obstacles and one who
creates obstacles. It is said that all kinds of people attained moksha as a
result of visiting the Someshwara Temple (Somnath temple in Gujarat )
– due to a boon granted by Shiva to Soma (moon god). People stopped all sort of
ascetic practices, austerities and sacrifices. All sinners were purified by
visiting Somnath. This caused imbalance in the universe.
Indra, the king of Devas, wanted to find a solution to the
problem and approached Shiva. He said He could not change the boon given to
Soma. Shiva directed Indra to Goddess Parvati.
Goddess Parvati gauged the situation and Mother Goddess decided
to rectify the imbalance.
She slowly rubbed Her body and from Her body appeared a
four-armed divine being with an elephant head. This was Ganesha.
Ganesha was asked to create obstacles in the path of sinners
who visited Somnath
Temple to attain Moksha.
Ganesha thus created impediments in the path of sinners and all people who
performed Adharma. They were caught in the web of desire and possessions. They
danced to the tune of the senses. Thus he created obstacles in the path of
Adharmic people.
Goddess Parvati also asked Ganesha to remove the obstacles
from path of all those who followed Dharma. To those who follow Dharma he is
the remover of all obstacles. He helps them attain moksha.
Thus Ganesha became the Lord of Obstacles.