Sri Kalahasti temple is located 36 km away from Tirupati in Chittoor district. The inner temple is constructed around 5th century and the outer temple was constructed in the 12th Century.According to ancient Tamil sources Sri Kalahasti has been known as the 'Kailas of the South' for slightly more than two thousand years and the small river on whose banks it sits, is the 'Ganges of the South.' Kailas is perhaps India's most revered spiritual symbol.
Srikalahasti got its name because in days of yore a spider (sri), serpent (kala) and elephant (hasti) elephant worshipped Shiva with great devotion. A spider lived in the inner sanctum and worshipped the Lord by weaving elaborate temples and images of Shiva. One day a breeze came up and caused the altar fire to destroy the spider's offerings. It became angry and was about to gulp down the flame, (realize the Self) endangering its (ego's) life. Appreciative of its devotion, Shiva appeared and granted the spider a boon. The spider requested moksha, release from the cycle of births and deaths. Accordingly it became one with Shiva, the Self. A cobra worshipped Lord Shiva by offering rare gems, pearls and rubies that it brought from Nagaland, a mythical place where Nagas (serpents) dwell.
Later, an elephant, fresh from its purifying bath, came to worship. In preparation it sprayed the altar with water from its trunk, scattering the gems. When the cobra returned it was angered to see its offerings disrespected. So it replaced the leaves with gems. This charade repeated itself every day until the cobra became fed up and decided to punish whomever was destroying its offerings. When the elephant returned to worship cobra slithered up its trunk and injected its venom. In agony the elephant dashed its head on the stone altar. The snake fell out of the trunk and died from its wounds and the elephant succumbed to the poison. Understanding that both had sacrificed their lives for the sake of their love of the Lord, Shiva resurrected them, gave them liberation and took them into his own body. At the foot of the linga one can see a spider, two elephant tusks and a five-headed (the five elements) serpent to remind the devotee of these acts of supreme devotion
This temple itself is a great architectural piece of art. Spend some time exploring the temple. You can see that the inside pillars are fresh as they are hundreds of years back because they were hidden from degradation by nature.