After an absolutely gutting final scene in the Season 6 episode "The Door," we finally learned Hodor's heartwrenching backstory. So what is the door in question and what does hold the door mean on Game of Thrones? It turns out that it's how Hodor got his name and one-word vocabulary.
The actual specifics get confusing, because we're dealing with time-travel (or maybe we're not, according to this piece for Business Insider that says Bran isn't time traveling on Game of Thrones), but that's sort of the key lesson for Bran in all this: bad things happen when you mess with the past. Earlier in the episode, we see Bran (dangerously and idiotically) solo-warg without the Three-Eyed Raven to The Night's King and his army of White Walkers. Inexplicably, The Night's King can see him, and actually reaches out and grabs him. Bran snaps back, but not before he's touched, and the mark lingers on his arm.
He panics and apologizes, but the Three-Eyed Raven wearily informs everyone that The Night's King can now enter the cave, and basically, they're all f*cked. It's time for Bran to become the Three-Eyed Raven. (Is he ready, he asks? Nope, replies raven. Ugh, Bran!)
So, because the White Walkers are literally en route, Bran and friends must flee. Unfortunately, Bran is still warging in the time of Wylis (aka Yung Hodor), because of course he is. Meera starts screaming at Bran to warg into present-day Hodor so they can get going (because while Bran is warging/unconscious, Hodor will not pick him up and get on the move). Bran hears Meera mid-Wylis warg and the Three-Eyed Raven tells him to listen to his friend.
Bran wargs into Hodor, mobilizes him, and the three of them begin to run out of the cave. There is a door they must pass through, and Hodor just barely breaks it open in time to get the three of them out. He closes it behind them, but the White Walkers are coming fast. Meera yells at him to "hold the door" while carries Bran's body further away. (Presumably, she believes something will kill the White Walkers on the other side of the door, but basically, she's just leaving Hodor to hold the door indefinitely.)
Bran somehow gets confused in the stressful moment — perhaps because he simply is not ready to time travel and/or warg at will — and accidentally wargs back into the time of past-Wylis while simultaneously being warged into present-day Hodor. To recap: Bran is accidentally warging in two places at once. Basically, this mixing of signals somehow leads to Wylis collapsing, screaming over and over again "hold the door," which is what Bran, who is watching this go down, can hear in present-day Hodor's ears.
Hodor holds the door to keep back the White Walkers and they eventually break through to destroy him, but it happens slowly. As it's happening, it seems like Wylis can feel it, and it appears as if he's having some kind of fit, clawing imaginary White Walkers off of him and screaming "hold the door" over and over. Eventually, as Hodor is slowly ripped to shreds by the White Walkers, Wylis' words get more and more garbled, until he is merely screaming something that sounds like "Hodor."
And thus, we learn all we ever knew about Hodor in the same scene in which we lose him. So what now? We've basically learned that it's Bran's fault that Hodor was the way he was, and we also learn why Hodor was so fiercely motivated to protect Bran. It was literally his life's purpose — what he was doomed/destined to do by the future. It's heartbreaking, to be sure. And it will probably cause Bran an overwhelming amount of grief for a very long time to come.