On seeing Hanuman, Ravana remembers the curse of Lord Siva on him that he would perish when a monkey resembling Siva strikes him! He doubts if it was Nandi the chief of Pramatha ganas of Siva with a monkey face. He thinks ‘could this be Bana the son of Bali and a devotee of Lord Siva sent by Nandi? The implication is ‘who has sent him’?
Hanuman tells his reason to come to Lanka5.50.14-17
Hanuman tells Ravana that he came to Lanka with the intention of seeing the lord of the raksasas and therefore destroyed the garden in order to see him. (Aham astrapasairna baddhum sakyah, “Brahmastra or the bondage of Yama cannot bind me. What to speak of other weapons? Even if the gods and demons join together also I cannot be bound” said Hanuman. “By the grace of Brahma I cannot be bound. Further it means, ‘this grace is bestowed not only on you but also on me’. “The moment these rakshasas bound me Brahmastra left me”.