Nobody knows for sure. Several theories compete, and none is settled. What studies do show: dreams draw on waking life without replaying it. In one study, 65 % of dream reports reflected recent waking experiences, but only 1–2 % replayed a real event as it happened (Fosse et al., 2003).
What do dreams take from waking life?
Fosse and colleagues (2003) collected 299 reports from 29 people. About 65 % showed aspects of recent waking life, yet "the episodic replay of waking events was found in no more than 1-2%". Dreams borrow pieces of the day and rebuild them.
This fits the continuity hypothesis, which says dreams reflect waking concerns. Its authors note that "empirical studies largely support" it, but that its exact form "remains vague" (Schredl & Hofmann, 2003).
Do dreams help memory?
In a study of 99 students learning a virtual maze, improved performance after a nap "was strongly associated with task-related dream imagery" (Wamsley et al., 2010). The four nappers who mentioned the maze in their dreams improved about ten times more, but none of their dreams replayed the task exactly, and four people is a tiny group: this is a correlation, not proof.
People who played Tetris saw its pieces as they fell asleep, and so did three patients with amnesia who couldn't remember playing (Stickgold et al., 2000).
The main theories
Activation-synthesis: one theory says dreams are the forebrain making a story out of signals generated in the brainstem during REM sleep (Hobson & McCarley, 1977).
Threat simulation: one theory says dreaming evolved "to simulate threatening events" and rehearse escaping them (Revonsuo, 2000).
Protoconsciousness: one theory says REM sleep provides "a virtual reality model of the world" that helps build and maintain waking consciousness (Hobson, 2009).
The default network: one proposal says the brain's default network, with visual and movement areas, is "the likely neural correlate of dreaming" (Domhoff & Fox, 2015).
Some researchers think dreaming has no function at all and is a by-product of sleep, as Revonsuo notes when setting out his own view. The debate is open.
Questions
Why do we dream?
Science doesn't know for sure. Leading theories link dreaming to memory, rehearsing threats, or the brain making sense of its own activity in sleep; none is settled.
Are dreams made from our memories?
Partly. In one study 65 % of dream reports reflected recent waking life, but only 1–2 % replayed an actual event.
Do dreams have meanings?
Studies link dream content to waking concerns, but they don't support fixed meanings for dream images.
Sources
Hobson, J. A., & McCarley, R. W. (1977). The brain as a dream state generator: An activation-synthesis hypothesis of the dream process. American Journal of Psychiatry, 134(12), 1335–1348. https://doi.org/10.1176/ajp.134.12.1335
Hobson, J. A. (2009). REM sleep and dreaming: Towards a theory of protoconsciousness. Nature Reviews Neuroscience, 10(11), 803–813. https://doi.org/10.1038/nrn2716
Schredl, M., & Hofmann, F. (2003). Continuity between waking activities and dream activities. Consciousness and Cognition, 12(2), 298–308. https://doi.org/10.1016/S1053-8100(02)00072-7
Schredl, M. (2000). Continuity between waking life and dreaming: Are all waking activities reflected equally often in dreams? Perceptual and Motor Skills, 90(3), 844–846. https://doi.org/10.2466/pms.2000.90.3.844
Fosse, M. J., Fosse, R., Hobson, J. A., & Stickgold, R. J. (2003). Dreaming and episodic memory: A functional dissociation? Journal of Cognitive Neuroscience, 15(1), 1–9. https://doi.org/10.1162/089892903321107774
Wamsley, E. J., Tucker, M., Payne, J. D., Benavides, J. A., & Stickgold, R. (2010). Dreaming of a learning task is associated with enhanced sleep-dependent memory consolidation. Current Biology, 20(9), 850–855. https://doi.org/10.1016/j.cub.2010.03.027
Stickgold, R., Malia, A., Maguire, D., Roddenberry, D., & O'Connor, M. (2000). Replaying the game: Hypnagogic images in normals and amnesics. Science, 290(5490), 350–353. https://doi.org/10.1126/science.290.5490.350
Revonsuo, A. (2000). The reinterpretation of dreams: An evolutionary hypothesis of the function of dreaming. Behavioral and Brain Sciences, 23(6), 877–901. https://doi.org/10.1017/S0140525X00004015
Domhoff, G. W., & Fox, K. C. R. (2015). Dreaming and the default network: A review, synthesis, and counterintuitive research proposal. Consciousness and Cognition, 33, 342–353. https://doi.org/10.1016/j.concog.2015.01.019