You know, doing a search on google would be the best way of tackling this.
But from what I know, this issue is still being debated by scientists. I think that dreams are when your subconscious grabs some random bits from your memories of things that really affected you can replays it again.
However, dreams may have more of a ... spookiness about it. My mother used to dream vividly of places that our family was going to go, even right down what clothes we were wearing. Bear in mind that the clothes she saw us wearing were ones that she hadn't even bought or seen before yet.
Also, there have been many cases in history where dreams have been used to warn people, or even for God to state his instructions, as seen in the Bible.
"For God speaketh once, yea twice, yet man perceiveth it not. In a dream, in a vision of night, when deep sleep falleth upon men, in slumberings upon the bed; Then he openeth the ears of men and sealeth their instruction..."
Book of Job, 33:14-16