Peruvanam Gramam was one of the 64 Gramams or hamlet found by Parashurama Avatar of Vishnu after reclaiming the land of Kerala from the sea. Four Sastha temples at Akmala, Kuthiran, Edathiruthy and Oozath are located on the boundaries of Peruvanam Gramam and Thiruvullakkavu Sastha Temple is located at the centre of the Gramam. Irattayappan is the ‘Grama Adhipathi’ (King) and Thiruvullakkavu Sastha is considered the ‘Grama Rakshakan’ (protector).
It is said that the temple was founded by Pooru Maharshi, King Yayati of Hastinapura. Pooru Rishi who was looking for an ideal spot to perform Tapas (intense meditation) found the place where the present Peruvanam temple is located to be ideal. The place was then known as Pooru Vanam or forest. He performed intense penance here. He is believed to have had darshan of Mahadeva here.
Another legend has it that Pooru Rishi was traveling around the world with a Shivling that he had discovered in a lake in Badarinath. When he was traveling through the Peruvanam area the Shivling got stuck on the branch of a tree. This Shivling was consecrated at the Madathilappan temple. Yet another legend is that the Rishi worshipped the Shivling atop a tree branch.
In ancient times the administration of the temple was headed by Yoga Thiripadi who was elected by Peruvanam Namboothiri yogam. When the last Yogathiripadi died in the 18th century CE, the temple administration was given to Kochi kingdom. The Ootu of the temple was carried out by Paravur kingdom. But when Paravur kingdom merged with Travancore in 1764 CE, the Travancore king claimed the administration over the temple.
The temple for a period was under the control of the Travancore kingdom. A peace treaty was signed between Kochi kingdom and Travancore kingdom and as a result, the temple came under the control of Kochi kingdom. The connected between Travancore kingdom and the temple exists even today. Maharaja of Travancore bears the expenses for Utcha Pooja, Pradhosha Nivedyam, Nira Puthiri and Koothu in the temple.