Projection is a defense mechanism in which an individual recognizes their unacceptable traits or impulses in someone else to avoid recognizing those traits or impulses in themselves subconsciously.
People protect their self-esteem by denying characteristics, impulses, or feelings they find threatening while seeing those same characteristics in someone else.