Why does bread have holes in it that nobody poked there?
Bubbles got there first. Yeast in the dough is alive — it eats, breathes out gas, and the stretchy dough traps the bubbles. Baking firms the dough around them: the bubbles become the holes.
From But WHY?! (p.29) — one of 162 illustrated answers for curious kids aged 7–12.