What is the function of dreaming? Does a particular hormone secretion interfere with dreaming? Why do some people dream more?
Dreams are hallucinations that occur during certain stages of sleep. They’re strongest during REM sleep, or the rapid eye movement stage, when you may be less likely to recall your dream.
Research is yet to reveal the true reason of dreams. But we know for sure it is not one reason.

Speculated Reasons:

1. Dreams as fight-or-flight training

One of the areas of the brain that’s most active during dreaming is the amygdala. The amygdala is the part of the brain associated with the survival instinct and the fight-or-flight response.

One theory suggests that because the amygdala is more active during sleep than in your waking life, it may be the brain’s way of getting you ready to deal with a threat.

2. Dreams as memory aides

One widely held theory about the purpose of dreams is that they help you store important memories and things you’ve learned, get rid of unimportant memories, and sort through complicated thoughts and feelings.

Research shows that sleep helps store memories. If you learn new information and sleep on it, you’ll be able to recall it better than if asked to remember that information without the benefit of sleep.

How dreams affect memory storage and recall isn’t clearly understood yet.

3. Creative times!

One theory for why we dream is that it helps facilitate our creative tendencies. Artists of all kinds credit dreams with inspiring some of their most creative work. You may have awakened at times in your life with a great idea for a movie or a song, too.
Without the logical part of the brain working, emotional and illogical thoughts take over your mind!

Eectroencephalography (EEG), electro-oculography (EOG), and 
electromyography (EMG) are used to monitor neurological data from the brain to reveal information about neurological activities in the sleeping brain.

Here is a scientific literature (pdf) you can go through for in-depth study ( this link leads to ResearchGate page, you can read it there or download the pdf) :
https://www.researchgate.net/publication/281071308_The_Role_of_Dreams_in_the_Evolution_of_the_Human_Mind