The young man is not really in a bad mood but is only putting on an act in order to attract Norman Gortsby's attention and start a conversation. This act would seem to be a bit of reverse psychology. Ordinarily a man who is looking for a handout will be polite and pleasant. He will approach the other person with a friendly smile. This young confidence trickster has figured out that there are too many panhandlers behaving the same way. If he behaves in just the opposite way, by not smiling, by not being polite and pleasant, he can perhaps achieve two results: (1) he will attract more attention and interest; (2) he will not be taken for a panhandler.
The young man intends to explain his bad mood with his complicated story about losing his hotel when he went out to buy a cake of soap. He does succeed in getting Gortsby to listen to the entire story, but he does not succeed in convincing him that his story is true. The con man can hardly expect the story to work every time. He is playing a numbers game. If he can only succeed with one person each evening he can earn several hundred pounds a year without really working. (The average clerk's salary in those days was one pound a week.)
When Gortsby, who turns out to be unexpectedly sophisticated, exposes the young man as a fraud because he doesn't have the cake of soap, he puts the trickster in a really bad mood. The con man has only an hour or two in which to operate before it gets too dark and cold for likely prospects to be staying outdoors. He goes off in a huff because he has wasted too much of his valuable time going through his whole routine with a deadhead.
Gortsby was right about him from the start. Then Gortsby found a cake of soap and became wrong about the con man. Then when Gortsby learns that the soap belonged to someone else, he realizes he was right about the con man in the first place, but now he is out one sovereign as a painful lesson. He should have trusted his instincts. There was another flaw in the con man's scam. Why didn't he just go to another hotel and tell his story to the desk clerk and ask to be trusted overnight? Isn't that more sensible than going around telling his cock-and-bull story to perfect strangers in a public park? Gortsby should have wondered about that. The con man wouldn't go to a hotel, of course, because he didn't want to stay in a hotel.
We need to remember that the young man is actually a confidence trickster who is trying to use his talent to fleece the protagonist out of some money. Therefore, when he flings himself so violently onto the bench beside Gortsby with a loud expletive, he is trying to create an impression of a man who is suffering singular bad luck. As Gortsby asks what is the problem with this young man, he explains that he came into the city to a hotel only to find that the hotel did not exist any more. Therefore, he went to a new hotel, leaving his belongings there, and then went out to buy some soap, but then forgot the name and location of his hotel, and thus will probably have to sleep on the Embankment that night. As the young man himself says:
"There's a nice predicament for a fellow who hasn't any friends or connections in London!"
Thus the young man weaves his story to explain the bad mood he is in to try and get Gortsby to give him some money.