Kali, drunk with the blood of the demons she has killed, rules the banyan forest of Tiruvalangadu and terrifies it, until Shiva comes and she challenges him to dance. He drops an earring, picks it up with his toe and lifts his foot to his ear, and she cannot follow. At Chidambaram she loses the same contest and is sent to the edge of the town.
Parvati sends out Kali to kill Shumbha and Nishumbha, who live in the banyan forest, and gives her the forest to rule. Kali drinks the demons' blood and their army's and becomes terrible; the forest's people suffer. The sage Munjikesa Karkodaka asks Shiva to come, and he comes in a fierce form. Kali says: dance with me, and if you win, the forest is yours. They dance. Shiva lets his earring fall, picks it up with the big toe of his left foot and lifts it to his ear, and holds the pose, the urdhva tandava. Kali says she cannot dance that, and gives way. Shiva tells her nobody but he is her equal, and that whoever comes to his temple must worship her first. Karaikkal Ammaiyar, the ghost-bodied saint, came here on her head to see the dance, and her bronze with cymbals sits beside it.
At Chidambaram Kali is the old mistress of the Thillai forest when Shiva comes to dance there. She challenges him; he wins with the raised foot; she leaves the centre of the town to him and goes to its northern edge in anger, where her temple stands, worshipped as Thillai Kali, and is softened there as Brahma Chamundeswari. The temple is credited to the Chola-era chief Kopperunchinga in the thirteenth century.
Sources: Arulmigu Bhadrakali Amman temple, Tiruvalangadu, Tamil Nadu HR&CE; Replete with historical facts: Thiruvalangadu Vataranyeshwarar temple, The Hindu; A banyan forest where Shiva won dance contest against Kali, New Indian Express (Chithra Madhavan, 2016); Thillai Kali Temple, Wikipedia