It's a safe bet that everyone you know has said, on multiple occasions, "I had a weird dream last night" (or words to that effect).
Specific dreams may be interesting only to the dreamer, but the fact that dreams exist at all is the subject of endless fascination. (Fun fact: the scientific study of dreams is called oneirology, derived from "oneiron," the Greek word for dream.) With all the study that has taken place, there is still no one universally accepted theory as to why we dream.
Sigmund Freud, the father of psychoanalysis, thought dreams were all about repressed desires. He believed our conscious minds don't allow us to think disturbing thoughts, so we hide them in our unconscious. Dreams, therefore, are outlets that allow these disturbing thoughts to be expressed.
As the 20th century progressed, Freud’s ideas were rejected in favor of more biology-based hypotheses. One of these is the “activation-synthesis” theory, popularized in the 1970s by psychiatrist John Allan Hobson. When we dream (the theory goes) sleep circuits are activated in our brain stem and our limbic system, the part of the brain that’s involved with emotions, sensations, and memories. Hobson believed that dreams are our brain's way of trying to interpret these random signals in some cohesive, logical way.
To me, the "activation-synthesis" theory makes more sense than some other fairly modern theories. For instance, the “reverse-learning” theory proposes that lots of useless thoughts build up in our brains during the day, and that dreams are a way of clearing our brains of these thoughts to make room for new and better ones. While it's true we have too much junk rattling around in our heads, it's a puzzle how our unconscious decides what to dream about, and therefore forget.
Harvard medical researcher Deirdre Barrett describes dreaming as simply “thinking in a different biochemical state” and believes we continue to work on our problems and objectives while in that state. Her research concludes that while anything may get solved during dreaming, the two areas dreams are especially likely to help are anything where vivid visualization contributes to the solution, and any problem where the solution lies in thinking outside the box (the theory being that, when awake, we get stuck because we are bound by convention).
These are but a few of the theories that exist in abundance; a quick internet search will yield a dozen or more. None of them has been proven; there may never be consensus on why these narratives—some happy, some sad, some peaceful, some terrifying—play out in our brains each night.