People with damage to the brain’s parietal lobe, which integrates sensory information, don’t dream. One hypothesis suggests that while we sleep, the parietal lobe continues generating signals, and our forebrain tries to make a story out of this activity.
Other researchers have suggested that dreams occur when short-term memories are encoded and moved to long-term memory, or when unwanted connections are removed from memory.
Evolutionary psychologists contend that dreams have a specific survival value. We mostly dream about threats or stressful situations. This may be so we can safely rehearse strategies for dealing with them.