Gopanna - later known as Bhadrachala Ramadas - was a revenue officer in the Golconda Sultanate in the 17th century. He was posted near the village of Bhadrachalam on the Godavari River, where there was an ancient but dilapidated temple to Ram.
Gopanna fell in love with Ram. He began using the revenue taxes he collected - the Sultan's money - to rebuild and beautify the Ram temple at Bhadrachalam.
When the Sultan Aurangzeb-era governor found out, he was furious. This was embezzlement of government funds, regardless of how beautiful the temple was. Gopanna was arrested, brought to Golconda fort, and thrown into prison. He was required to repay the entire sum - an amount impossible for him to produce.
Gopanna sat in his cell and composed kirtan after kirtan to Ram: "O Ram, I built your house with this money. It was your money I spent - now your devotee sits in chains. Will you let me suffer for serving you?"
According to tradition, Ram and Lakshmana appeared at night to the Sultan's treasury, handed over the exact amount owed in gold coins, and left a note: "Payment from Ram and Lakshman of Bhadrachalam for the temple built by our devotee Gopanna."
In the morning the Sultan found the gold and the note. He released Gopanna immediately, shaken to the core. Gopanna walked out of prison singing Ram's name.
The temple he built still stands at Bhadrachalam. It is called the "Tirupati of the Godavari."