Everyone has this "self" he protects, and it comes with a conscious understanding of our worth. This "self or I" is known as "ego". In psychoanalysis, ego is the part of a person's mind that tries to match the hidden desires (= wishes) of the id (= part of the unconscious mind) with the demands of the real world, while Cambridge dictionary defined ego as:
your idea or opinion of yourself, especially your feeling of your own importance and ability:
In psychoanalytic theory proposed by Sigmund Freud, ego coexist with the id and superego, the id (the agency of human drive) while the superego(The ethical components of personality). This is the idea, the Id gives us that drive for basic needs like food, sex etc. While the superego which is the ethics conflict with the drive urging the sense of living a healthy body lifestyle while ego is the consciousness.
Photo source
Ego develop to mediate between the unrealistic Id and external reality. Ego works by reason considering social realisties and norm, it could postpone certain pleasure to avoid crisis while the Id is unreasonable, it's a personality trait commonly found in a child who desires everything without a careful thought. Though the id is primitive, it has a stronger force than ego, Sigmund Freud described the id as a horse, while the ego as the rider. In a simple analogy
The id wants to satisfy it desires
The ego checks if the desire is realistic to the external world
The superego evaluate if it's good or bad to our body
So this three personality trait starts an internal conflicts.
Ego is also a feeling of self importance, it help protect our self-worth and may feel offended if it receive anything of less. Sometimes people equate ego to pride because it has similar traits, a person with ego could be as reserved as a person with pride, though pride boast on physical possesion, ego is focused on reality, mediating our desires from consequences . A person with an ego develop a taste that set him apart from others who doesn't see things from same perspective or reality, thus, chooses to maintain an isolated lifestyle.
Ego comes with a sense of realization of self worth. That understanding keep us guided from unrealistic expectations while it assist an individual through the process of decision making. Ego can be develop, the more we know, the stronger the ego. It creates within us the knowledge that we are bigger than we carried ourselves in the past.