Ego starts with your identity. When you feel you have an identity, and you feel it needs to be protected, then ego acts as the defence mechanism. Ego defends your identity. The moment your identity is attacked or hurt by someone, the ego will feel the pain. Ego feels pain when your identity gets destroyed. Hence, ego is left with no choice but to protect your pride, your identity.
So, what does ego do when attacked ? Ego attacks back the moment you are attacked. Ego can't sit without feeling hurt. Ego plans it's revenge. Sometimes, it's instantaneous, sometimes it is planned for future. Ego is your pride. Your pride cannot take insult aimed at you. Your chin up is forced to bend down. It's not easy for man to bend to man, he generally only bends to God.
As a baby you were born egoless. You were born without an identity. You had no achievements by your name to instill in you a sense of false pride. In that egoless state, you were innocent. Your questions were innocent. You did not have any motive. You existed in the present, you felt pure joy, and in this heightened state your mental learning was at its fastest. Ego prevents learning. Ego destroys your innocence. Ego causes hurt, pain. Ego is created by yourself, but has no value to you.
We often feel pain when someone hurts, degrades, or insults us. It's natural. We all want respect. Respect can only be given by another person. That same person has the power to insult. If praise makes you happy, criticism will make you sad. This dependence on others for your emotional well-being leaves you a quite vulnerable. Because you can't predict which way the wind will blow. If only you had faith and confidence in your own self, about your own worth, the direction of the wind would not change the direction of your emotions. Praise would not make you happy, criticism would not make you sad. You know what you are. To do that, you will need to do 1 thing. Drop your ego.