In this article, there is a mention of "constant battle going on inside our brains between different sets of neurons, fighting over who gets control of certain parts of the brain." Because of which visual cortex always gets activated (even in sleep)so that it's neurons are not repurposed for other activities. Hence we dream.
http://m.nautil.us/issue/91/the-amazing-brain/your-brain-mak...