Existential angst has been a source of suffering since the dawn of civilization. To believe that when we die, we're gone, and that's the end of it, is deeply troubling. It means that life is meaningless — that we're just a blip in history. Most of us will be forgotten within few generations after we're gone as if we never existed, other than perhaps a marker on the ground where we're buried.
Religion was created in part to relieve existential anxiety. It provides hope that there is something bigger than all of us, and for some, that we go to a better place after we die. Belief in an afterlife is comforting, even if nobody really knows what happens after we die.
Originally, the concept of heaven and hell was a metaphor for how we're remembered after we die. If you're remembered fondly, then you're in heaven. If people curse you and are glad you're gone, then you're in hell. That's how it's described in the Hebrew Bible. Christians took that concept and interpreted it literally — that heaven and hell were actual places that people went depending on whether or not they believed in and accepted Jesus as the messiah.
People do all sorts of nasty things in an effort to get into heaven, like fly planes into buildings and blow themselves up in suicide bombings. James Holmes, the Aurora Theater Shooter, when asked why he killed all those people responded, "to be remembered." He didn't care that he'd be remembered for doing something evil; he just wanted to be remembered, probably to relieve his existential angst.