One day, Lord Brahma and Lord Vishnu got into a heated argument. They both claimed to be the greatest god in the Universe. Lord Brahma said, "I have created everything on earth thus, I am the most powerful god." Lord Vishnu replied, "But I am the preserver of all your creations. Thus, I am the greatest."
As they continued arguing, a fiery lingam erupted from the earth between them. It stretched higher, without any end in sight. Both Lord Vishnu and Lord Brahma stared at it, trying to figure out its origin and end.
They both decided to find it out for themselves, and wagered that they will figure out the mystery before the other one. Lord Vishnu transformed into a wild boar and stared digging into the earth to find the lingam’s origins. Lord Brahma transformed himself into a swan and flew up to find its end.
Lord Vishnu went on digging into the earth, but was unable to find the lingam’s origins. He gave up and emerged from the earth, defeated. Lord Brahma flew high, but was nowhere near finding the top end of the lingam. He saw a ketaki flower on his way, and carried it in his beak, back to earth.
He met Lord Vishnu and showed him the flower, claiming that he saw it on top of the lingam.
Suddenly, the sky reverberated with thunderstorms, and Lord Shiva came forth from the lingam. He pointed at Lord Brahma and said, "You are lying! Because of the sin, I curse you that no one will worship you celebrate your festivals or build your temples." He further banished the use of ketaki flower from being used in his worship.
He turned to Lord Vishnu and said, "You have been honest and humble. Thus, you shall be worshipped, festivals will be celebrated in your honour and temple will be built for you on earth."
Lord Brahma was ashamed of his act, and asked for forgiveness. He and Lord Vishnu bowed down in front of Lord Shiva, conceding defeat and accepting Lord Shiva as the greatest god in the Universe.