Smeared in red (blood), a full-moon face, with the deer, and the bow to the left (in His hand), in the right hand an arrow and axe, wearing ga.nga and crescent moon, always worshipped by vishNu and brahma, burnt the three cities by His smile, to that God of three worlds, the enemy of pura (purAri), pray.
tri pura a.ntakar : destroyer of three cities (vIra mUrti)
The tripurA signify the three components(impurities) of bondage (pAsam) namely aham (ego), karma(deeds and their effects), mAya (illusion). When God shows His grace all these impurities are burnt, bliss remains and Lord Shiva dances there. (padhi aNukiR pachu pAcha n^illAvE - thirumUlar)
Three demons kamalAkshan, tArukAkshan, vidhunmAli got a boon from the Lord that they can not be destroyed unless all three of them come together, and attacked by a single arrow. Then they created forts in different areas and ruled the world.dEvAs who were disturbed by them complained it to the Lord. But Lord Shiva said as long as the three demons pray Him He won't destroy them. So mahA vishNu took the form of a sage, and taught the three demons mAyAvAtham, resulting them to stop praying the Lord, praising themselves and torturing dEvAs. Since all the good qualities of them were lost the Lord came for the destruction of the purAs. The three demons came together to fight against the Lord forgetting their boon.
The earth became the chariot for the Lord, brahma the charioteer, vishNu the arrow, sun and moon the wheels, the mountain mEru as the bow and the serpent vAsuki as the string in the bow. Thus all the gods were present in some form in that chariot. But the fire and god of death were in the wheel instead of the arrow. vinAyaka broke the wheel to put them in the arrow. Finally when everything was ready dEvAswere proud that only with their help God is going to destroy the tripuras. But Lord Shiva didn't use any of them. He smiled and in that smile the three purAs were burnt down.(The rudhrAksha appeared from the three eyes of Lord Shiva during tripurasaMhAra) The thought of dEvAs that without their help the Lord wont be able to destroy the tripuras proved foolish.
The purpose of destruction by Lord is only for purification. Lord gave life to the three demons. Though they went wrong they initially were devotees. They repented for their mistake. The Lord forgave them and gave one of them the great work of fanning Him with chAmaram, and the rest two as His security in His abode. (mUvAr puraN^kaL eriththa anRu mUvarkku aruL cheydhAn - thiru nyAna chamban^dhar)
thiru adhikai is the temple associated with the burning of thripurA. Below is a depiction of this in this temple.