Ego has been a weapon of survival for our species since the dawn of time. As a matter of fact, it transcends to animals as well. The world is full of predators and preys. The sense of ego or self-esteem gives the brain an additional boost to triumph survival. This sense communicates to our conscience that we are special hence we deserve to keep standing on our feet.
Ego can drive passion, enthusiasm, desire, creativity and at the same time put you in misery, self doubt, make one arrogant, pompous and so forth.