This is how I heard. At one time the Blessed One was staying in the province of Uruvelā on the Nerañjarā river bank at the foot of the Goatherd’s Banyan tree, just after the Blessed One had become fully enlightened. Then, while the Blessed One was alone in meditation, a thought occurred in his mind thus:
“This Dhamma that I have realized is deep, hard to see, hard to understand, peaceful and sublime, cannot be realized by reasoning, subtle, and to be experienced by the wise. But this generation is stuck in desire, delights in desire, and rejoices in desire. For a generation that is stuck in desire, delights in desire, and rejoices in desire, realizing this Dhamma that is about the law of causality and the law of dependent arising will be very hard to understand. Nibbāna is the state of dispassion, cessation, stilling in all formations, complete removal of all defilements, and the destruction of craving. Attaining this Nibbāna is very hard for such a generation.
“Therefore if I were to teach the Dhamma and if others would not understand me, that would be tiresome for me, and that would be troublesome for me.”
Thereupon these astounding verses, not heard before in the past, occurred to the Blessed One:
“I realized this Dhamma with so much hardship.
It is of no use teaching this to others.
These beings who are burdened
by lust and hate wouldn’t easily
understand this Dhamma.
“This Dhamma practice
is like going upstream.
It is deep, subtle, and hard to see.
These beings that are fired by lust
and covered by darkness of ignorance
will never see this very refined Dhamma.”
As the Blessed One reflected thus, his mind inclined to living at ease, not to teaching the Dhamma. Then Brahmā Sahampati, having known the reflection in the Blessed One’s mind, thought: “Alas, the world is lost! The world will perish! The mind of the Tathāgata, the Arahant, the Supremely Enlightened One has inclined to living at ease, not to teaching the Dhamma.”
Then, just as quickly as a strong man extends his drawn-in arm or draws in his extended arm, Brahmā Sahampati disappeared from the brahmā world and reappeared in front of the Blessed One. Brahmā Sahampati arranged his upper robe over one shoulder, knelt down with his right knee on the ground, worshipping respectfully, he said to the Blessed One: “Bhante, let the Blessed One teach the Dhamma! Let the Fortunate One teach the Dhamma! There are beings with little defilement. If they do not get to hear the Dhamma they will deteriorate. There will be those who will understand the Dhamma if they get to hear it.”
Having said this, Brahmā Sahampati further said this verse:
“In the past
among the people in the province of Magadha,
many impure views appeared
that were introduced by defiled people.
Therefore please open the door
to the Deathless, Nibbāna!
Let all beings hear the Supreme Dhamma
discovered by the Supreme Buddha
who has stainless wisdom.
“Just as one standing on a mountain peak
might see below the people all around,
so too, oh wise one,
the sage who sees everything,
please, ascend the palace made of the Dhamma.
Look at the people
disturbed by sorrow
and burdened by birth and decay!
“Rise up, oh hero,
victor in battle with Māra!
Oh caravan leader, debt-free sage,
wander in the world.
Oh Blessed One,
please teach the Supreme Dhamma!
There will be those who will definitely understand.”
Then the Blessed One, having understood brahmā’s request, surveyed the world out of great compassion for beings, with the eye of a Buddha. As the Blessed One surveyed the world with the eye of a Buddha, the Blessed One saw some beings with little defilement, and some with much defilement, some with the potential for keen wisdom, some with less potential for wisdom, some with easy access for understanding things clearly, some with weak access for understanding things clearly, some easy to teach, and some difficult to teach, some live seeing fear in wrongdoing and fear about the next world, some live without fear of wrongdoing and without fear about the next world.
Just as in a pond of blue or red or white lotuses, some lotuses having been born in the water, grown in the water, and submerged in the water do not rise up from the water. Some lotuses having been born in the water and grown in the water, stand at an even level with the water. Some lotuses having been born in the water and grown in the water, rise up from the water and stand without being soiled by the water. So too, surveying the world with the eye of a Buddha, the Blessed One saw some beings with little defilement, and some with much defilement, some with the potential for keen wisdom, some with less potential for wisdom, some with easy access for understanding things clearly, some weak access for understanding things clearly, some easy to teach, and some difficult to teach, some live seeing fear in wrong doing and fear about the next world, some live without fear of wrong doing and no fear about the next world.
Having seeing the world in this way, The Blessed One answered Brahmā Sahampati in verse:
“I opened the doors to the Deathless,
Let those who have ears
come with confidence.
Oh brahmā, foreseeing trouble,
I didn’t teach people the Dhamma
which has been well realized by me.”
Then Brahmā Sahampati, thinking, “The Blessed One has accepted my request for teaching the Dhamma,” paid homage to the Blessed One and disappeared right there.
Read this translation of SN 6.1 Ayācana Sutta: The Discourse on Brahmā’s Request on ReadingFaithfully.org or on SuttaCentral.net and DhammaTalks.org.