There’s quite a few people attempting to explain exactly what happened to Hodor in Season 6 Episode 5 which explains the origins of Hodor. Some theories are far too complicated in terms of explaining the space-time continuum paradox that any series dealing with time travel undergoes. But I feel that the idea of Hodor’s essence is quite simple and doesn’t need a great deal of exaggeration to make sense of it all.
So in the scene, we have Bran escaping on the sled device with Meera carrying him off while Bran is still having visions of the past at Winterfell. At the same time, Bran had warged into Hodor as Hodor was unable to respond to Meera’s pleas as a result of the stress of the army of the dead invading their hiding area. While they escape, the Night’s King assaults the Three Eyed Raven but not before he is able to pass on a last message to Bran. Bran witnesses in the past the Three Eyed Raven’s demise as the companions storm down a tunnel towards a blocked exit.
We then have a scene of Leaf sacrificing herself to buy a little more time for the three companions to escape. Hodor manages to wedge the door open while Meera bears Bran off in the distance while screaming, “Hold the door!” Hodor uses his massive size and strength to act as a temporary barrier while Meera desperately carries Bran off and continues to scream “Hold the door.” Still in the past and without the Three Eyed Raven to guide him any longer, remains in the past Winterfell while catching site of Wylis.
At that point, the past becomes connected to the present as Bran hears Meera’s orders to Hodor while Bran looks on at Wylis with sympathy. Somehow Wylis undergoes a warging as if Bran’s presence joins Wylis’ mind with the present day Hodor. Wylis’ eyes slide into the back of his head, indicating that he has been warged/possessed. Shots between Hodor sacrificing his body to hold the door and Wylis crying out uncontrollably “hold the door!” occur while Bran helplessly looks on.
So essentially, Bran is responsible for Wylis becoming Hodor because he wargs into Wylis while he was still connected to the present Hodor. The Three Eyed Raven no longer could advise him to relinquish control over Hodor and Bran simply is still too inexperienced to understand and be able to control his full powers. I see the situation being that Bran was stressed out and accidentally grabbed hold over Wylis’ mind while he was still trying to control Hodor. Also, Wylis’ mind was destroyed because he experienced the trauma of his own death. I think the swapping between present and past Hodor/Wylis was meant to demonstrate what Wylis was experiencing in his mind until his mental state was reduced to simply “Hodor.”
One may argue that Hodor has known his fate since this point in time. I would say it’s more of a subconscious thing. In the books so far, whenever Bran wargs into Hodor, Bran essentially tucks away Hodor’s consciousness. Bran cannot actually read Hodor’s mind as far as what’s been given but he essentially overrides Hodor’s bodily functions. So all that was Wylis was probably pushed into a state where it was destroyed because Bran could not mentally protect Wylis and exposed him to a horrible fate. I mean, it’s essentially autism here because of the trauma involved. There’s really not much more to read into in terms of how Hodor came into existence.