system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: How my body knows not to shit itself while asleep.

Urination could be included as well.
gpt
When you go to sleep, your brain releases special juices into your body that make it so it won't do stuff, like acting out your dreams. That way if you're running in your dream, you won't start running in real life. This also makes it so if you poop in your dream (5 year olds shouldn't say the S word, mister!), you shouldn't poop in real life.

Sometimes this doesn't work though, and is why some people sleepwalk and some people have problems with wetting the bed. Their bodies don't "turn off" for the night like they should.