There is a mythological story behind Lord Ganesha. One day when Goddess Parvati went to take bath, she asked Nandikeshwara to guard the door and not let anyone enter inside. But being Lord Shiva's faithful, when Lord Shiva came, he didn't stop him from entering. Seeing that she didn't have anyone as faithful to her as Nandi was to Shiva.