Mahishasuramardini stotram is based on Devi mahatmyam in which Devi takes the forms of Durga, Lakshmi and Sarasvati to slay Madhu and Kaitabha, Mahishasura, and Sumbha and Nisumbha respectively. This stotra is said to have been composed by Ramakrishna Kavi.
The most celebrated role of Goddess Durga -- as Mahishasura Mardini, the Slayer of Mahisha, the Buffalo Demon -- is so central that it merits separate consideration.
STORY
Her basic myth is simple, as the greatest stories tend to be: Mahisha, a great demon (asura), has undertaken extraordinary austerities, and thereby accrued such vast power that even the Gods can no longer defeat him. In successive battles, they lose the three worlds to Mahisha's superior might -- and the Cosmic Order is thrown into disarray.
Clearly, a hero and savior is needed -- but who can defeat an enemy that is mightier than the Gods? Answer: The Power (Shakti) that created both the Gods and the enemy in the first place. In order to access that Power, the Gods must reverse the downward unfolding of Divine manifestation, i.e. the cosmic tattvas. (Not coincidentally, this is also the goal of any sadhana undertaken by a human devotee. To help understand the lesson offered here, think of Mahisha as the individual human ego.)
Accordingly, all the Gods simultaneously offer Their own individual powers back to their common Source. And as They do so, They behold an extraordinary sight, as the Source begins to materialize before their eyes:
"An exceedingly fiery mass like a flaming mountain
Did the Gods see, filling the firmament with flames.
That peerless splendor, born from the bodies of all the Gods,
Unifying and pervading the triple world with its lustre, became a Woman."
(Devi Mahatmyam, 2.11-12.)
She is Maha Devi, the Great Goddess, the Mother of all beings, divine and mortal. Taking the warrior form of Her avatar, Goddess Durga, She departs on Her lion mount to meet the demon. A battle of nine days and nine nights ensues, during which Devi decimates Mahisha's armies using lesser Goddesses produced from Her own body.
At last, She and Mahisha alone remain standing on the corpse-strewn battlefield. Of course, Mahisha cannot win, but he takes the forms of many powerful beasts as he tries. While he is in mid-transformation from Buffalo back to Human form, Devi finally slays him, thus saving the Universe, restoring the Cosmic Order -- and earning the title, Mahishasura Mardini.