Hanuman appears in the Ramayana as a character in someone else's story, and becomes an object of worship a very long time afterwards. The gap is the interesting fact about him.
In Valmiki he is the minister of the monkey king Sugriva, and the finest thing about him is not his strength but his judgement. He leaps the ocean to Lanka, finds Sita in the ashoka grove, and behaves throughout with a tact the epic pauses to admire. Sent for a specific healing herb on a Himalayan peak and unable to identify it, he brings the entire mountain, which is played for affection rather than mockery. When Rama asks him who he is, he answers that when he does not know who he is he serves Rama, and when he knows who he is he and Rama are one. That verse is the seed of everything later devotion does with him.
But devotional worship of Hanuman is not early. It grows through the second millennium of the common era, roughly a thousand years after the epic took shape, and its decisive moment is Tulsidas and the Ramcharitmanas, composed in Awadhi in the late sixteenth century, which carried the Rama story to people who read no Sanskrit. The forty verses of the Hanuman Chalisa are ascribed to Tulsidas, an attribution the scholarship does not dispute, and the text is now among the most recited in India.
He is a chiranjivi, one of the immortals, granted life for as long as Rama's story is told, which produces the conviction that he is present at every recitation of it and accounts for the practice of leaving a seat for him. He is celibate, which makes him the god of wrestlers, bodybuilders and soldiers, and his akharas keep Tuesday and Saturday for him.
His shrines, a stone daubed orange under a tree, are now the most numerous in India, and they are also the easiest to establish, which has given them a contested role in disputes over public land.