“Ego” is used loosely. In psychoanalytic thought it has technical meanings. In contemporary spirituality it usually names the felt sense of being a separate someone behind one’s eyes, needing to defend itself, needing to win.
Traditions diverge sharply. Some (especially some modern non-dual teachings) speak of “killing the ego” — which is misleading. Others (Jungian individuation, some Tibetan and integral frameworks) see a healthy ego as necessary to a healthy life, with spiritual maturity a transformation, not an erasure, of selfhood.
Most agree that identification with a separate-self-image, taken as the whole truth of who one is, is a cramping of what one actually is.