An ego is a person's sense or perception of self. In psychology, the term goes a bit further to define ego as the part of a person who balances his primitive nature against his idealistic side, or superego.
The famous psychologist Sigmund Freud regarded the ego as the realistic side of a human, the go-between of the animal nature instinct and the perfectionist moralist. To Freud, ego was a healthy part of the human psyche. The term ego also often connotes what is actually an over-inflated ego. Ego is not basically bad. To have a healthy sense of oneself is beneficial, but to think too highly of oneself is not. A person described as having an ego generally has an over-inflated ego.