During the Samudra Manthan, when Lord Vishnu in the Mohini roop was distributing nectar, a drop fell on the Earth. The rakshasa Kesi cunningly stood in the line amongst Devas. Vishnu recognised this, and gave Kesi poison halalhal instead of nectar. But because this drop from the hands of Vishnu himself, Kesi grew very powerful. Blessed with boons after severe penance, he started troubling everyone including Rishis and Munis. All the sadhus went to Garalapuri and started a yagna while praying to Rudra. Lord advised them to continue their prayers. Shiva advised them that he would destroy the egoistic Kesi when he came there. As envisaged by the Lord, the demon Kesi came there to trouble them. Shiva assumed his Rudra avataar, grabbed Kesi and hurled him into the yagna kunda. However, as Kesi burnt, the poison that flowed through his body started troubling everyone. Lord Shiva intervened to protect his devotees, and swallowed the ashes.
Everyone requested Lord Siva to stay at the spot to protect everyone. It is said that having a bath in the sangam or confluence of the rivers at Nanjanagudu helps in destroying the Nanja. That is why this place is called Nanjanagoodu and Shiva is called Nanjundeshwara. The rivers Kapila and Kaundinya were named after Rishi Kapila and Rishi Kaundinya.
Nanjanagoodu is the place to come to so that mankind can achieve simplicity and get rid of the poisons that afflict our lives.