The story of Thiruvananthapuram Padmanabhaswamy temple in Kerala is found in the Ananthasayana Mahatmya. The story is also found in the old palm leaf records of the temple.
Divakara Muni, a devoted follower of Vishnu, engaged in
profound tapas while residing in 'Aanarthadesa.' One day, Maha Vishnu
manifested before the sage in the form of an enchanting child. Captivated by
the divine presence, the sage implored the God-child to stay with him, agreeing
to treat him with utmost respect. The child, however, set a condition that any
disrespect would prompt his immediate disappearance. Accepting the terms, the
hermit cared for the child despite his playful antics.
During one meditation session, the mischievous child took
the sacred 'salagram' used for worship and created disturbances. Unable to
endure the behavior any longer, Divakara Muni rebuked the child. True to the
agreement, the child vanished instantly, leaving the sage in sorrow. Before
departing, the child revealed that he could be found again in Ananthankadu.
Realizing the identity of his vanished guest, Divakara Muni was consumed by inconsolable grief. He followed the path the child had taken for days without food, rest, or sleep. Eventually, he reached a wooded area near the sea, witnessing the child entering a massive 'Ilappa' tree. The tree collapsed into the ground, transforming into the divine form of Sree Maha Vishnu, stretching from 'Thiruvallam' to 'Trippapur.' The divine form had its head at ‘Thiruvallam’ (a place about 3 miles from East Fort at where the Temple of Sree Padmanabhaswamy is located) and its feet at ‘Trippapur’ (5 miles away towards the north).
Overwhelmed by the majestic manifestation, the Sanyasi
prayed for a condensed form. Bhagavan Vishnu granted his request, reducing the
image to three times the length of the Sanyasi's Yoga Dand. As an offering, the
Sanyasi presented a raw mango in a coconut shell, a tradition that continues to
this day. Bhagavan Vishnu ordained that Tulu Brahmins should conduct poojas in
the temple, and half the priests in the temple, even now, represent the Tulu
region.
Another version links the temple's origin to the Namboothiri
Sanyasi Vilvamangalathu Swamiyar, a Vishnu devotee. The legend closely
parallels that of Divakara Muni. When Sree Maha Vishnu appeared in the
Ananthasayana Roopa (reclining on Anantha) before the sage at Ananthankaadu,
the sage offered unripe mangoes from a nearby tree in a coconut shell. This
humble offering, known as 'nivedyam,' continues, with salted mango as a
prominent offering. The original coconut shell has been encased in gold.