Very nice Question.
I appreciate.
Actually EGO in our SHAASTRA's, is defined as AHANKAR.
The original meaning of this word is "Feeling of oneself - different from others".
Later Brahma Vidya PRAVARTAKs' when told to the general public that AHANKAR is a constraint to achieving the God - the PARABRAHMA PARAMESHWAR, then that time it was taken by general public that it is a bad element.
And it was synonymously treated as "Over Proud".
When Over Proud or any feeling in Excessiveness is bad, it is also true that for smooth functioning of this Universe, AHAMKAR is essential.
Very rare persons, who are very high saints or AVATAR (incarnations), can avoid this AHANKAR, otherwise these all - KAAM, KRODH, LOBH, MOH, BHAYA, CHINTA, RAAG, DWESH, AHANKAR, these all are the forces of ADHYA SHAKTI - PRAKRUTI (Mother Nature). No one can overcome these forces - NO HUMAN.
Love & regards to all,
Aum Namah Shivay