The katha
Yudhishthira asked Krishna where the Ekadashi fast came from and why it is held so dear. Krishna told him a story from the first age, the Satya Yuga.
A demon named Mura grew so powerful that he drove Indra and the devas out of heaven. They wandered the earth, and at last they went to Shiva for help. Shiva sent them on to Vishnu, the protector of the worlds.
Vishnu went out against Mura and his army. He scattered the army, but Mura himself fought on, and the battle went on for a very long time. At last Vishnu withdrew to rest. He entered a cave at Badarikashrama, in the Himalaya (Hemavati in some tellings, Simhavati in others), and lay down to sleep.
Mura followed him into the cave, meaning to strike the Lord while he slept. But as the demon raised his weapon, a radiant young woman came forth from Vishnu's own body, armed and shining. She challenged Mura, fought him, and slew him there in the cave.
When Vishnu woke, he saw the demon lying dead and the maiden standing beside him. She told him what had happened. Pleased, Vishnu said: you were born from me on the eleventh day of the waning moon, so your name shall be Ekadashi, the Eleventh. Ask for a boon.
Ekadashi asked that whoever fasts on her day with devotion be freed of their wrongdoing and come close to the Lord. Vishnu granted it, and said that this fast would be dearer to him than any other. From that day the eleventh tithi of both fortnights has been kept as Ekadashi.
In the tellings that name it, this Ekadashi of the waning half of Margashirsha is called Utpanna, the one that was born. The other Ekadashis of the year — twenty-four in most years, twenty-six when there is an extra month — each have their own name and their own story in the same Mahatmya.