So, say you have a situation where a man helps someone else in order to forget all of his own problems in the world. Is there a word for something like that? Edit 1: I'm asking about the man who is also doing the act.
In general psychological terms, it could be a form of avoidance.
The person is trying to avoid dealing with his own problems, so focuses on something else as a distraction. This distraction could be any number of things, but in this case it just happens to be helping somebody else.
From an excerpt of Developmental-Behavioral Pediatrics on the ScienceDirect website:
Avoidance can be understood as denial: it is as if the person has decided that there is no stressor, and therefore there is no need to change behavior, perception, or emotional response. In this situation, the only way the individual can deal with it is to “forget” it or distract oneself from trying to deal with it.
Egoistic altruism could be used as a term to describe this. It is very nicely explained in the video below: