On many occasions the Buddha refused to answer questions about the origins of the cosmos, saying that speculating on such things would not lead to liberation from dukkha. But the Agganna Sutta presents an elaborate myth that explains how humans became bound to the wheel of samsara and life after life in the Six Realms.
This story is sometimes called a Buddhist creation myth. But read as a fable, it is less about creation and more about the refutation of castes. It seems intended to counter stories in the Rig Veda that justify castes. The Buddha's objections to the caste system are found in other early texts; see, for example, the story of the Disciple Upali.
The Agganna Sutta is found in the Sutta-pitaka of the Pali Tipitika, It is the 27th sutta in the Digha Nikaya, the "collection of long discourses." It is assumed to be a sutta (sermon) spoken by the historical Buddha and preserved through oral recitation until it was written, about the 1st century BCE.
The Story, Paraphrased and Greatly Condensed
Thus I have heard -- while the Buddha was staying at Savatthi, there were two Brahmins among the monks who wished to be admitted to the monastic sangha. One evening they saw the Buddha taking a walk. Eager to learn from him, they walked at his side.
The Buddha said, "You two are Brahmins, and now you are living among homeless mendicants of many backgrounds. How are the other Brahmins treating you?"
"Not well," they replied. "We are reviled and abused. They say we Brahmins are born from Brahma's mouth, and the lower castes are born from Brahma's feet, and we shouldn't be mixing with those people."
"Brahmins are born of women, like everyone else," the Buddha said. "And people both moral and immoral, virtuous and non-virtuous, can be found in every caste. The wise do not see the Brahmin class above all others, because a person who has realized enlightenment and become an arhat is above all castes.
"The wise know that anyone in the world who places his trust in the dharma can say, 'I am born of dharma, created by dharma, an heir of dharma,' no matter what caste he was born into.
"When a cosmos comes to an end and contracts, and before a new cosmos begins, beings are mostly born in the Abhassara Brahma world. These luminous beings live for a long time, feeding on nothing but delight. And while the cosmos has contracted, there are no suns or stars, planets or moons.
"In the last contraction, in time an earth formed, beautiful and fragrant and sweet to taste. Beings who tasted the earth began to crave it. They sat gorging themselves on the sweet earth, and their luminescence disappeared. The light that left their bodies became the moon and sun, and in this way night and day were distinguished, and months, and years, and seasons.
"As the beings stuffed themselves with sweet earth, their bodies became courser. Some of them were handsome, but others were ugly. The handsome ones despised the ugly ones, and became arrogant, and as a result the sweet earth disappeared. And they were all very sorry.
"Then a fungus, something like a mushroom, grew, and it was wonderfully sweet. So they began stuffing themselves again, and again their bodies grew courser. And, again, the more handsome ones grew arrogant, and the fungus disappeared. After that they found sweet creepers, with the same result.
"Then rice appeared in abundance. Whatever rice they took for a meal had grown again by the next meal, so there was always food for everyone. During this time their bodies developed sex organs, which led to lust. Those who engaged in sex were despised by the others, and they were driven out of the villages. But then the exiles built their own villages.
"The beings who had given in to lust grew lazy, and they decided to not gather rice at every meal. Instead, they would gather enough rice for two meals, or five, or sixteen. But the rice they were hoarding grew mold, and the rice in the fields stopped growing back as quickly. The rice shortages caused the beings to distrust each other, so they divided up the fields into separate properties.
"Eventually a man took a plot that belonged to another, and lied about it. In this way theft and lying were born. People who were angry with the man hit him with fists and sticks, and punishment was born.
"As these evil things arose, the beings decided to choose a leader who would make judgments and hand out punishments. This began the Kshatriyas, the caste of warriors and leaders.
"Others chose to put aside unwholesome things, and they built themselves leaf huts in the forest and engaged in meditation. But those that weren't too good at meditation settled in villages and wrote books about religion, and these were the first Brahmins.
"Others became tradesmen, and this began the caste of Vaishyas, or merchants. The last group became hunters, laborers and servants, and these became the lowest caste of Sudras.
"Anyone from any caste might be virtuous or not. And anyone from any caste can walk the path and be liberated by insight, and such a person will attain Nirvana in this very life.
"Dharma is the best thing for everyone, in this life and the next. And he with wisdom and good conduct is best of gods and men."
And the two Brahmins rejoiced at these words.