First, let’s look at this as if ‘ego’ really exists :-)
Ego is the mistake we make of thinking there is a separate “me,” a cohesive, centrally-located (in our headless ‘head’) being called “I” or “me,” and then identifying with it.
Ego is the mistake we make of thinking that separate “me” is separate from all other entities and from the Awareness that underlies everything.
Ego is the moment-by-moment continuity of that mistake, our insistence and absolute certainty that we really are a separate psychological entity.
So you ask, “Why does ego make that mistake, and continue making it? I thought there were no mistakes in this perfect Universe”
The answer leads us to the second part, but first, notice that the only thing that would even ask that question is…wait for it…the ego!:-) Because only a psychological sense of a separate “me,” would ever care about making mistakes. Once there’s no sense of a separate “me,” there could be no mistakes…only what Is.
So Second, let’s get Real. There is no such thing as the ego. The ego doesn’t exist. It’s just a concept, a label, assigned to what “we” think are “our” individual choices and actions, when in fact there really isn’t any “we,” and “we” are not the Doer. There is only the One Self. Or if you prefer, Being, Consciousness, pure Awareness, the Emptiness, God. It doesn’t matter - all those are just conceptual labels, too, just like ‘ego.’
It remains one of the most exquisite paradoxes of the so-called ‘spiritual path,’ that the only thing that thinks there really is ‘the ego,’ and needs to work on getting rid of it…is the ego!
You don’t really have a separate ego that leads you astray from the ‘path’ and keeps you from seeing Enlightenment or your True Nature. That’s all spiritual materialism. Don’t think “you” are so important or arrogant. “You” are only a false concept. There is only The One, unfolding perfectly and exactly as It deems, not “you.”
So what to do about this thing that seems to exist, but actually doesn’t? That seems to get in the way of your ‘progress’ (as if you had somewhere to go:-) but actually doesn’t.
Ignore it! Cut yourself a big break. Surrender this ‘ego’ and all your illusory Doership. Meditate, yes. Be kind to others, sure. Live a simple, non-gluttonous life, absolutely. But don’t get wrapped up in “your” progress, “your” path, “your” ego.
If you notice you are ‘strongly identified’ with your false psychological self, and then after a year or two of really meditating hard and really being kind and selfless, and really living a simple, desire-free life, you’re still strongly identified with your false psychological self, so what? The only thing that would care about your ‘progress’ or be frustrated by not moving past your self-centered ego is…your ego…which doesn’t exist! Don’t go around in circles! Let go! Let the ‘e’-go. Just relax, “Be as you are,” (Ramana Maharshi) and feel the Motion of the One, moving All Things, infinitely far behind your supposed ‘personal’ choices.
BTW: This is my straightforward, ‘explainify’ type of answer, as tends to be my style. For a ‘much more fun’ answer, check out the one from my friend Edg Duveyoung, whose answers tend to be so humorous, they can make your ‘ego’ pee its pants 😂