It happens because we think about things before we go into NREM and it converts into our brains when we sleep.
Our brain gets active during REM sleep. Anxiety/depression can trigger dreams to be remebered in the morning
{"name":"Dreaming", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"what is the deepest sleep?, Why do we dream?","img":"https://www.quiz-maker.com/3012/images/ogquiz.png"}