The word ego is the Latin form of the first person singular pronoun. It derives from the Indo-European root eg, which appears in English as I and in German as ich
The technical term ego came from Dr. Sigmund Freud as part of his theory concerning human behavior and repressed urges. His theory states that people have an id, ego, and super ego. The ego is part of the id and it represses infantile urges by the id. At a later stage the super ego develops out of the ego determining what is acceptable to the ego and what needs to be repressed. Repressions disappear from consciousness but live in the id. The job of the psychoanalysis is to uncover the repressions for what they are and to replace them by acts of judgement.