Krishna observes that Arjun is overwhelmed by the feeling of Aham-Karta (I am doer) -Ahankaar and it is responsible for his despondency. Krishna advises Arjun (2.41) to use coherent intellect (buddhi) to break Ahankaar and reach self (2.49).
Ego is a small part of Ahankaar . It is called arrogance when one goes through pleasure polarity of success/win/profit and depression, unhappiness, anger when one goes through pain polarity of failure/defeat/loss. It is jealousy when others are going through pleasure polarity and sympathy when it is for pain polarity.
It is there when we are collecting physical possessions and also exists when we shed them. It drives doing (sansar- world) and non-doing/leaving (sanyaas- Renunciation). It is the cause of destruction as well as creation. It is in knowledge as well as in ignorance.
In praise, Ahankaar gets boosted and in criticism, it suffers. Both states make us amenable to manipulation by others. In short, Ahankaar is behind every emotion in some sense or the other and these emotions influence our external behaviour. Ahankaar might appear to drive us to success and prosperity, but it is like getting temporarily high on drugs.
I, me, my and mine are the four legs of Ahankaar and by avoiding using these four words in daily conversations and thoughts, one can weaken Ahankaar to a large extent.
Ahankaar is born when we choose to identify with one polarity or the other and that's why Krishna in 2.48 advised Arjun to remain choiceless in the middle where there is no space for Ahankaar . Have food when hungry; have warm clothes when cold; fight when needed; borrow feelings when needed without choosing to identify with any of them, which is kind of childlike.
Source - Daily World