One day Goddess Parvati was at home on Mt.Kailash preparing for a bath. As she didn’t want to be disturbed, she told Nandi, her husband Shiva’s Bull, to guard the door and let no one pass. Nandi faithfully took his post, intending to carry out Parvati’s wishes.
Okay Goddess Parvati.
Nandi, could you please guard the door and make sure nobody comes in, I am going to prepare myself for a bath.
When Shiva came home and naturally wanted to come inside, Nandi had to let him pass, being loyal first to Shiva.
Why are you guarding the door? I command you to let me in! This is my home!
Yes sir, sorry. Goddess Parvati told me to guard the door.
Parvati was angry at this slight, but even more than this, at the fact that she had no one as loyal to Herself as Nandi was to Shiva.
Out of jealousy, she took the turmeric paste (for bathing) from her body and breathing life into it, she created Ganesha, declaring him to be her own loyal son.