This Narvarna mantra is taken from the Chandi Path, or Durga Saptashati, which is a sacred Hindu text of 700 verses from the Markandeya Purana dedicated to Goddess Chandi (Durga), detailing her victory over demons to establish dharma.
Navarna Mantra or Chandi Mantra. It is dedicated to Goddess Chamunda, a fierce aspect of Goddess Durga who represents the combined destructive power of the Divine Mother to eliminate evil, negativity, and obstacles
In Mysuru, Kannatika, the Chamundeshwari Temple on Chamundi Hill, sits on the ground where Chamunday killed the buffalo demon, Mahishasura.
The festival of Navaratri (Nine Nights) festival eulogises the battle between Mahishasura and Durga, culminating in Vijaya Dasami, a celebration of Victory of the demon. This story of the "triumph of good over evil" carries profound symbolism in Sanatan Dharma, particularly devotees that worship the goddess Shakti.
The story is told in chapter seven of the Devi Mahatmya of the Skanda Purana
When Maheshasura was young, he gained a boon from Lord Brahma, after many years of meditating on Brahmas name. The boon was that he was granted a single wish, and Maheshasura wished that he be immortal, however, Brahma said no, as this would make him equal to the Gods, and so, Maheshasura wished that he could be killed by no God, nor man, nor animal.
High on the power of "immortality", Maheshasura started killing the gods, and conquering the three worlds (Triloka: the worlds of Earth, Heaven and Hell) with his army, and tried to capture Indraloka (the kingdom of Lord Indra).
The gods got very worried and went to Brahma for help. Brahma refused to help as he had already given Maheshasura his word. The gods also approached, however, as a God, Vishnu could not help either.
So they went to the Himalayas and went to meet Shiva. Shiva said he wished he could help but he could not as he was a man himself. At this moment, Parvati overheard the conversation and detected a loophole in Brahma’s boon. The boon was no man can kill Maheshasura, however, a woman can.
However, Parbati was not warrior and she needed weapons to go kill Maheshasura. So all the gods started giving her their powers and weapons. Suddenly she had so many weapons that she did not have enough arms to hold them, so incarnated as the ten armed Chamundi.
• The bearer of Pinaka (Siva) drawing forth a trident from his own trident presented it to her
• Visnu bringing forth a discus out of his own discus gave her.
• Varuna gave her a conch.
• Agni a spear.
• Maruta gave a bow as well as two quivers full of arrows.
• Indra, lord of devas, bringing forth a thunderbolt out of (his own) thunderbolt and a bell from that of his elephant Airavata, gave her.
• Yama gave a staff from his own staff of Death.
• Varuna, the lord of waters, a noose.
• Brahma, the lord of beings, gave a string of beads and a water-pot.
• Surya bestowed his own rays on all the pores of her skin.
• Kala gave a spotless sword and a shield.
• The milk-ocean gave a pure necklace, a pair of undecaying garments, a divine crest-jewel, a pair of ear-rings, bracelets, a brilliant half-moon (ornaments), armlets on all arms, a pair of shining anklets, a unique necklace and excellent rings on all the fingers.
• Visvakarman gave her a very brilliant axe, weapons of various forms and also an impenetrable armour.
• The ocean gave her a garland of unfading lotuses for her head and another for her breast, besides a very beautiful lotus in her hand.
• The (mountain) Himavat gave her a lion to ride on and various jewels.
• The lord of wealth (Kubera) gave her a drinking cup, ever full of wine.
• Sesa, the lord of all serpents, who supports this earth, gave her a serpent-necklace bedecked with best jewels. Honoured likewise by other devas also with ornaments and weapons, she gave out a loud roar with a defying laugh again and again..
So armed, Chamundi fought Maheshasura on top of a hill for ten days, after which she killed the buffalo demon, and the hill upon which she fought is now known as Chamundi Hill.