As per Hindu legend, a Pandya king Harikesari Parakkirama Pandian wanted to construct a temple for Hindu god Shiva at Tenkasi and went to Kasi to bring a lingam, the most common iconic representation of Shiva in South India. While returning to his palace with the prized lingam, he rested under the grove of a vilva tree, the favourite tree of Shiva. When a cow carrying the lingam refused to move from the spot, the king realised that it was a divine wish of Shiva, and he placed the lingam in the place where the cow halted. The place where the shivalingam brought from Kasi was installed came to be known as Sivakasi. Since he brought the lingam from Kasi, it came to be known as Kasi Viswanathar temple.