lord shiva and ma parvati has two sons ganesha and kartikeya. both the sons are equally dear to them.
once it happened that devas gave one divine fruit to shiva and parvati and told them that it is a special fruit. whoever will eat it, will get the supreme knowledge and immortality.
both the sons wanted to eat it. so this lead to an argument between them. to pacify the situation, shiva told them that whoever will circle the world three times and come back first will get the fruit.
now kartikeya also known as murugan (in tamil nadu) or skanda or subrahmanya is the god of war and he is also the commander in chief of devas army. his vehicle is peacock. being a true warrior or god of war, lord kartikeya took this challenge very seriously and started his journey around the world immediately without wasting anytime in thinking.
on other hand, ganesha who is god of wisdom, learning, arts and removal of obstacles knew very well that he is no match to kartikeya in this race. one of the name of ganesha is is ‘lambodara’ which means the ‘huge bellied lord’. lord ganesha vehicle is mouse/musakraj (in some stories, ganesha vehicle is also shown as peacock). so ganesha knew that with this huge belly and slow moving mouse he cannot defeat his elder brother kartikeya.
to ganesha, his parents are very dear. anything which is very dear to you becomes the center of your life and your life energy goes into it. so ganesha applied his intelligence and started circling his parents three times.
shiva and parvati asked him, what you are doing.
ganesha replied that for me my parents are my whole world. moreover within you is the whole universe. so i am circling the world. ganesha argument was right because he really meant it. he was not using any logic to win the race. ganesha really loves his parents. ask any small baby, for the baby his/her entire universe is his mother. so for ganesha, his world revolved around his parents and the other world to which kartikeya was circling was superficial to him.
lord shiva and ma parvati were pleased to listen the argument of ganesha. so ganesha got the blessings of his parents and won the divine fruit.
when kartikeya came back, he didn’t liked the argument and felt cheated. kartikeya left his parents abode to stay else where. as shiva and parvati wanted to visit kartikeya, so he told them that lord shiva can visit him on no moon day and parvati ma can visit him on full moon day.