It's why you dream.
Your brain just keeps going and going and going and when most of it shuts off for the night, that small bit that is still active? It keeps going and going and going, but now it lacks all the filters the awake mind has and thus you get dreams that make no sense.