Simulation theory of empathy
The simulation theory of empathy holds that humans anticipate and make sense of the behavior of others by activating mental processes that, if they culminated in action, would produce similar behavior. This includes intentional behavior as well as the expression of emotions.
Source: Wikipedia — Simulation theory of empathy (CC BY-SA 4.0)