Its the subconcious. Most of our dreams are playbacks of stimulation we recieved during the day and it shows up at random or in order of importance of how impressionable it was to our minds. The brain tries to resolve everything it absorbs and if it feels it has unresolved items it will resurface them in our dreams. Dreams can occasionally be warnings to us and they can be God trying to speak to us because we keep our minds too busy on other things beside hearing his voice in our waking hours. Throughout history God had to appear in a dream to many who changed the course of our world. But over all, we dream because our minds are working through all its information and unscramble any that is scrambled and delete what is useless. Dreams are the procesessing of information to clear out our subconcious. Sleep brings us closer to death where we lose control and our spirits are free to do what needs to be done.