a dream is some thing your mind makes up, your mind is like recorder it records everything that happens at day time and at night it replays parts of it and forms a story.
When you're asleep your mind still thinks so it makes up stories using your memories.
it's like "make believe" for when you're asleep.