As the Bhagavata tells it
Bhagavata Purana 12.8 to 12.9 · 2 min read
The sage Markandeya lived on the bank of the Pushpabhadra river in the Himalaya, and he had lived there for so long, praying and keeping his vows, that even death had given up on him. Nara and Narayana, the two sages who are forms of Vishnu, came to visit him, and were so pleased that they offered him a boon.
"I have seen you," said Markandeya. "What more could I want? But if you will grant me something, let me see your maya, your power of illusion, which makes the whole world believe it is real."
"So be it," they said, smiling, and went away to their own hermitage.
One evening, as Markandeya sat by the river at his prayers, a terrible wind rose. Clouds came up black and roaring, and rain fell in streams as thick as the axles of chariots. The sea rose. It swallowed the shore, then the plains, then the mountains, until the whole world was one ocean under the dark, and Markandeya was alone in it.
For millions of years, it seemed to him, he wandered in that water, starving, thirsty, torn by sea creatures and tossed by waves, sometimes sure he was dying, sometimes forgetting who he was at all.
Then he saw a rise of land, and on it a young banyan tree with fruit and new leaves. On one branch, on a single leaf, lay a little child, dark as an emerald, glowing in the darkness. He held his foot in both hands and was sucking his big toe.
"Who can this be?" thought Markandeya. "There is nothing left in the world, and here is a baby."
He came closer, weary and amazed, and as he did, the child breathed in. Markandeya was drawn in with the breath like a gnat, and found himself inside the child's body.
There he saw the whole world, exactly as it had been before the flood. He saw the sky and the stars, the mountains and the oceans, the cities and the forests and his own hermitage by the river. He saw himself, sitting at his prayers. Then the child breathed out, and he was back in the flood, looking at the baby on the leaf.
"Lord," he cried, "let me hold you!" He held out his arms, but the child was gone, and the tree was gone, and the ocean was gone. He was sitting by the Pushpabhadra in the evening light, at his prayers, as if nothing had happened.
He understood then what he had asked to see. The flood and the ages of wandering had passed inside a single moment, in his own mind. "This is your maya," he said, bowing to the empty air.
As the Mahabharata tells it
Mahabharata, Vana Parva 186 to 187 · 1 min read
In the Mahabharata, Markandeya tells the story himself, to Yudhishthira and his brothers in their forest exile, as something that happened to him at the end of an age.
He says that when the age ended the sun burned the world and the rains drowned it, and he swam alone in the waters, with nowhere to rest. Then he saw a great banyan, and on its branch a bed, and on the bed a little boy with eyes like lotuses, who spoke to him kindly.
"Markandeya, I know you are tired," the boy said. "Rest inside my body. I have made a place for you there."
The boy opened his mouth, and Markandeya went in. Inside he wandered for more than a hundred years through the whole world. He saw the earth with its kingdoms and cities, the Ganga and the Yamuna and the Sindhu, the seas and the mountains. He saw the gods in their heavens and the demons below, and people of every caste at their work, and the cattle in the fields. He walked and walked and never came to the end of it. At last a wind carried him out of the boy's mouth, and he fell at his feet in the empty ocean.
"Who are you?" he asked.
"I am Narayana," the boy said. "The waters are my home. I am the beginning and the end of the worlds, and I sleep here between the ages until Brahma wakes."
Then Markandeya bowed, and the boy disappeared, and the world began again. And Markandeya, telling Yudhishthira, says that the boy on the banyan was the same Krishna who was then their friend and kinsman.