when we fall asleep, our brains go into a sort of low-maintenance mode for a few hours. Sleepiness is caused partly be the build up of certain chemicals in our bodies over the day, and the brain can flush these out of your system while it’s asleep, so you’re alert and feeling refreshed when you wake up.
A lot of other things happen during sleep. Most of your body’s repair systems and defences work best while you’re asleep, so it’s like the body schedules its own maintenance!
While you’re asleep, your brain can do a lot of rewiring- making new connections in certain brain cells or destroying old ones. Your brain is taking stock of things it’s seen and learned, and making changes to better deal with those things in future! That’s probabyl part of what causes dreaming. 🙂