In the year 1680, when the Maharashtra king Venkoji Maharaja Chatrapati (1676–1688) of Tanjore was on a pilgrimage at Samayapuram, where there is a famous temple dedicated to Kali, Mariamman appeared to the King in his dream and told him -that she (the idol) was in a forest of Punna trees at a distance of about 3 miles from Tanjore. The King lost no time in rushing to the spot indicated to him and recovered the idol from the jungle.
A temple was constructed at the place and the idol installed and so the deity of this temple is known as Punnainallur Mariamman. It is said that the daughter of Tulaja Raja (1729–35) of Tanjore, who lost her eyesight in an illness, regained it on offering worship at this temple. 
Originally the Amman was in the form of white-ant hill (Putru). The Great saint Sadhasiva Brammendra swamy shaped the white-ant hill (Putru) into a form of Mariamman and also installed a powerful Chakra.
This temple located in Punnai Nallur, which is popularly known as Mariamman Kovil, Thanjavur and it is 5 km from Thanjavur Old Bus stand.