Legend of Chintamani Temple
Abhijeet was a great and powerful king who had everything in life except a son who would be the heir to his throne. The king and his wife at the suggestion of Rishi Vaishyampayane carried great penance and were finally rewarded with son who they named Gana. He later came to be known as Ganaraja.
The son was bright brave and gifted except he was also very aggressive. Ganaraja was once invited to visit the ashram of Sage Kapil. The sage was a good host and with the help of the Chintamani Ratna [a precious stone] he was able to serve the best of food to Ganaraj. Impressed by the ratna, Ganaraj wanted it for himself, but when Kapilmuni refused to part with the ratna, he forcibly took it away from him.
Goddess Durga who was Kapilmuni's mentor advised him to seek the help of Lord Ganesh.
Lord Ganesh responded to his call and battled with Ganaraj under a Kadamba tree and managed to get the ratna back for Kapilmuni. But by then Kapilmuni had lost all desire to possess the Chintamani ratna and he offered it Lord Ganesh. He tied the Chintamani Ratna around Lord Ganesh's neck and so he came to be known as the Chintamani Vinayak.
Since all of this occurred under a Kadamba tree, Theyoor was also known as Kadambanagar.