The myth says that the temple was built on the first day of Kali Yuga (around 5000 years ago). Most of the details we know is from the Palm leaves records which had been handed over through generations. According to the epics, it is believed that Balarama had visited the temple and had bathed in the temple pond before giving offerings. Most of the known facts/myths are taken from the book titled ‘Anantasayana Mahatmya’. According to it, a Tulu Brahmin named Divakara Muni consecrated the temple.
Divakara Muni was a great Vishnu Bhakta. While at ‘Aanarthadesa’, he performed deep tapas. One day Maha Vishnu appeared before the sage as a lovely child. The charming child attracted the attention of the sage. He requested the God-child to stay with him. The child made his stay conditional. Accordingly, the Sanyasi should treat him with respect. On failing to do so, he would vanish at once. This was accepted and the child stayed with him. The hermit gave him great care and tolerated the childish pranks. One day, when the sanyasi was in deep meditation at his prayers, the chills took the ‘salagram’ which the sanyasi was using for worship and put it into his mouth and made such a nuisance of himself that Divakara Mini was greatly angered and could tolerate it no further. He thereupon chastised the child. In accordance with the earlier agreement, immediately the child ran away and disappeared from the spot. While going he said, “If you wish to see me again, you will find me again in Ananthankaadu”. It was only then that Divakara Muni realized who his erstwhile child guest had been. The hermit was stricken with inconsolable grief and for many days followed what, he believed was the route taken by the child foregoing food, rest and sleep in the process.
Finally he reached a wooded area near the sea coast, caught a glimpse of the child disappearing into a huge ‘Ilappa’ tree. Immediately the tree fell into the ground and it assumed the form of Sree Maha Vishnu. The divine form had its head at ‘Thiruvallam’(a place about 3 miles from East Fort at where the Temple of Sree Padmanabha Swamy is located) and its feet at ‘Trippapur’ (5 miles away towards the north). Overawed by the majesty and the size of the divine form, which manifested before him, the Sanyasi prayed to the Lord to condense Himself in size so that he could behold Him. There upon the image of the Lord shrank to size, three times the length of the Sanyasy’s Yoga Dand. His prayers had been granted. He immediately offered a raw mango in a coconut shell(still this offering continues). The Lord ordained that, poojas to Him should be conducted by Tulu Brahmins. To this day half the number of Purohits(priests) in this Temple represents the Tulu region.
Another generally accepted version about the origin of the Temple relates it to the famous Namboothiri sanyasi Vilvamangalathu Swamiyar, whose name is linked with the histories of several temples in Southern India. This Swamiyar was also a Vishnu bhakta. The legend is almost identical to that of Divakara Muni referred above. It is said that, when Sree Maha Vishnu presented himself in the Ananthasayana rupa (in the form of reclining on Anantha) before the sage at Ananthankaadu, the latter had nothing worthwhile to offer Him. From a mango tree standing nearby, he plucked a few unripe mangoes and placed them in a coconut shell lying there and in all humility offered it as ‘Nivedyam’ to the Lord. Even today salted mango forms a major offering. The original coconut shell has been encased in gold. It has also been the practice in the Temple for the past several centuries that the morning ‘Pushpanjali’ is to be performed by a Namboothiri Brahmin sanyasi (designated Pushpanjaly Swamiyar) specially commissioned for this purpose.
In 1729 Marthanda Verma, the King of Travancore renovated the Temple. The old idol was replaced during this period to the one which devotees see today.
In 1758, the Kulasekhara Mandapam was built by under the direction of King Sree Karthika Thirunnal