Once the architects of Devaloga, Viswakarma and Mayan had an argument on whose skill was superior. Brahma, the god of creation informed Mayan that Viswakarma attained betterment as he built Vaikunta, the abode of Vishnu on account of accomplishments in a previous birth. He also informed Mayan that to attain similar status, he has to identify and build an abode near the river Kaveri similar to Vaikunta. Mayan inspected various places and finally identified Thiruvelliyangudi, where sage Markendeya was doing penance. He built a beautiful temple and its compound, which is believed to be the temple in modern times. Vishnu appeared as Sringara Sundaran (beautiful deity).