In early an early episode of season 6 of Game of Thrones, "Home", through his magic Greensight ability, Bran sees a vision of Winterfell in the past. He notices a young Hodor, then named Wylis (Walder in the books) that could speak. Do the books, or series, explain any way why this changed, why Wylis became Hodor and stopped speaking? Hodor.
In season 6 episode 5, "The Door", the origin of his nickname and only sentence "Hodor" is revealed.
It's the first time that someone is warging into the same person in the present and the past. It looks like it connected Hodor's consciousness of both times. Young Hodor in the past recognizes the word "Hold the door!", which are shouted at Hodor in the present. Young Hodor repeats them until only "hodor" is understandable.
I assume that the words weren't the only thing which was sent to the past, but rather young Hodor was feeling everything when old Hodor was attacked. The trauma of foreseeing his own death prevents him from speaking anything else than "hodor".
Massive spoiler alert if you haven't seen the 5th episode of season 6 already. Seriously, here there be dragons, turn back now, you have been warned. I'll update this sometime later when it's no longer considered "spoiler" territory.
As shown in tonight's episode, it would seem it was Bran reaching back to Hodor as a child using his abilities, causing him to seize up on the ground yelling, "Hold the door!" This was boiled down to just, "Hodor," the more he screamed it, and it seems it just stuck as his name given that's all he'd been able to say since.
This would seem to be possible as we've seen Bran viewing past events for Ned, and Ned seemingly turning around as though he could actually hear Bran call him.
Tonight, the White Walkers attacked the cave Bran has been hiding out in, and as Meera was dragging Bran to safety while Bran was still in a vision about the past in which Hodor was present, she yells back to Hodor to hold the door to keep the undead from getting through so that they might escape. When Bran manages to warg into the past Hodor, just as he can and does with the present Hodor, the events described above occur, and it would seem they caused Hodor to only be able to say that for the rest of his life until this point.
Whether this holds true for the books, in full or in part, remains to be known, but given this site discusses movies and TV shows, this answer should suffice.
As mentioned by others, in S06e05 "The Door", we see the events that caused young Wylis (Walder in the books) to become Hodor, and only be able to say Hodor. It involves a sort of astral time travel projection.
Bran, who is a warg, in that he can project his mind into animals, found out he could warg into Hodor. The characters explain this as Hodor being simpler, not fully human in terms of mental abilities.
Bran later finds out he can project his mind through time, with the help of the Three-Eyed Raven.
During the episode, Bran screws everything up, which forces the Three-Eyed Raven to push Bran faster and beyond what he is ready for. He starts "uploading" information into Bran, which basically causes his powers to act unintentionally. The "uploading" part is implied by the Raven, and explicitly stated by the producers in the "Inside the Episode", a behind the scenes recap produced by HBO. (see below)
Because of this, Bran:
- Can't control where he projected to in the past, the Three-Eyed Raven took him there.
- He subconsciously wargs into Adult Hodor, like an automatic reflex to try to escape because of Meera, while unconscious in the present
- Still mentally conscious in the past, having no idea what is happening in the present aside from Meera's yelling echoed
- Most importantly, he accidentally wargs into Young Wylis because Meera's yelling has confused him.
The three key things:
- Bran is unable to control what is happening. He's not ready for the Three-Eyed Raven's power.
- Young Wylis is not simple minded. Bran wargs into an occupied brain.
- Bran's mind is divided between the Three-Eyed Raven, Old Hodor, and Young Wylis.
Whatever magic that allows this, some or all of these factors cause Young Wylis' brain to fry. He drops to the floor and starts convulsing. He starts repeating a phrase, and is essentially having a stroke or a seizure.
He isn't just traumatized mentally, he seems to experience physical brain trauma. He is reduced in mental faculties because of it, which allow bran to warg into his brain afterwards without further seizures. Like as if Bran carved out a hole in the brain perfect to warg into.
Further more, this will be true to the books, as RR Martin personally provided the production with details on how it will be in the books, so that show is accurate. See the "Inside the Episode" below.
As to WHY it happened like this, it seems that the Three-Eyed Raven, who can see into the future and the past, set this up to happen because it had to happen. Without Wylis becoming Hodor, Bran probably wouldn't be where he was and couldn't escape. It's a giant predestination paradox. How sci-fi of them.