According to psychoanalytic theory (Sigmund Freud) there are three structures of a personality.
1. Id ( like a child, acting on pleasure principal)
2. Ego (like an adult, acts on reality principal, rational, controls id)
3. Superego (like a society, only works on moral perfection)
So ego plays a role in restraining the id and not letting superego dominate it. It aims for realistic goals.
Sometimes, conflicts arise, and they produce anxiety for ego. It is threatening for ego. To protect from anxiety, ego creates an unconscious strategy which we call defense mechanisms.
Defense mechanisms are always active in us, it is healthy and natural. However it can turn pathological in some cases, like it turned for Kazutora.
Started a page on ig, Psychoanimelysis, posted them here as well