There is a whole surah in the Quran named after a cave — Surah Al-Kahf, "The Cave." This is the story it is named for.
Long ago, in a city that had forgotten Allah, there lived a small group of young men. Everyone around them bowed to statues. Their king demanded it. But these young men had worked something out for themselves: statues cannot hear, cannot help, and cannot create. Only Allah can.
So they said it out loud. The Quran tells us their words: "Our Lord is the Lord of the heavens and the earth. We will never call upon any god besides Him."
That was a dangerous thing to say. The king would have hurt them, or forced them back to the idols. So they made a choice: they left everything — their homes, their families, their city — and went out to a cave in the hills.
And in the cave they made a dua: "Our Lord, give us mercy from Yourself, and make our situation right." They did not have a plan. They just trusted Allah.
Then Allah did something no one expected. He put them to sleep.
Not for a night. Not for a week. Allah kept them sleeping in that cave for about three hundred years.
And He took care of every detail while they slept. The Quran says the sun moved past their cave so it never burned them. Allah turned them over as they slept, to the right and to the left, so they stayed comfortable. And at the entrance of the cave lay their dog, stretched out with his paws forward, keeping watch. Allah mentions that dog in His Book — that is how carefully He looked after them.
When they finally woke up, they felt like they had napped for a day. One of them went into the city with an old coin to buy food — and everything had changed. The buildings, the people, the money. Nobody worshipped idols any more. The people of that city now believed in Allah.
The young men had gone to sleep as strangers who had to hide. They woke up in a world that agreed with them. And their story went into the Quran forever, so that children like you would know their names were worth remembering, even though we do not know their names at all.
These were young people. That is the part not to miss. The Quran calls them fityah — youths — and it says "they were young men who believed in their Lord, so We increased them in guidance." They were the only ones in their whole city who got it right, and being the only one is lonely and frightening. But they said the true thing anyway and left the rest to Allah. And notice how gently Allah cared for them while they slept: even the dog at the door is in His Book.
From Surah Al-Kahf (18) of the Quran, verses 9 to 26.