Perhaps he was looking for something that he thought might be under the bed, like a lost toy or a book. He got so involved in the search that he just stayed there for a while.
In another scenario, the boy could call for help. His dog, which was sleeping outside the room, comes running in. The dog bravely barks at the thing under the bed, scaring it away. The boy then hugs his dog tightly and decides to never sleep in that room again until he is sure it's safe.
I'm not sure specifically which 'the boy under the bed story' you mean. It could be about a boy hiding under the bed for various reasons, like playing a game of hide - and - seek, or perhaps he's scared and using the bed as a hiding place from something.
It could be about a sick boy resting in bed or a boy having a dream while in bed.
Maybe he's just really tired and needs a good rest.
Maybe he's tired and it's time for sleep.
Maybe he got sick or had an accident and needed to be in the hospital for treatment.
The scene might show the boy relaxing or maybe daydreaming on the bed.
Maybe he caught a cold. That's a common reason for sneezing when in bed.
Maybe there's a creepy shadow or a strange noise that's freaking him out.