Welcome, gartien asimbahwe.
'Ego' is the Latin word for 'I' but its sense in modern philosophy depends very much on its context. In Descartes' 'cogito, ergo sum' (not his own phrase but a Latin translation of his French phrase, 'je pense, donc je suis', 'I think therefore I am/ exist'), the ego is merely the thinking self independent of the body. There is no association with selfishness nor in the sequel to his being a sole self, no hint of solipsism - that hus self is the only thing that exists.
The American philosopher, R.B. Perry, referred to the 'egoistic predicament' which merely signified that one has no access to the world, to external reality, independently of our mental representations of it. I leave aside problems here, the point is simply that a purely epistemological claim is being made, a claim about what we can know. (https://en.wikipedia.org/wiki/Egocentric_predicament.)
In Freud the ego's meaning takes a different turn. The way in is through the 'id':
The id is conceived by
Freud as the source of instinctive impulses; and the impression con-
veyed by his description is that it consists, not of organised instinctive
tendencies, but of inchoate impulses seeking discharge. It is the
human psyche, of course, that Freud is considering. But it is difficult
to believe that man differs fundamentally from the animal world
where the more primitive aspects of his mentality are concerned;
and Freud's description of the id as the source of instinctive impulses
seems singularly out of keeping with the instinctive endowment of
animals, which, as we have seen, is highly specific and highly orientated towards outer reality. According to Freud, the id is indifferent
to outer reality, and the adaptation of impulses to outer reality only
becomes possible through the differentiation of the ego from the surface
of the id. The ego is, of course, conceived by Freud as a structure ;
but the id is described in a manner which implies that it is essentially
structureless and is merely a reservoir of instinctive energy. The function ascribed to the ego is that of selecting and regulating id-impulses
in such a manner as to render behaviour adapted to our outer conditions. (W. Ronald D. Fairbairn, 'A Critical Evaluation of Certain Basic Psycho-Analytical Conceptions', The British Journal for the Philosophy of Science, Vol. 7, No. 25, Sigmund Freud
Centenary (May, 1956), pp. 49-60 : 52.)
When we turn to ethics that 'ego' gains yet other associations.
'Egoism' in ethics is widely taken to be a view of life on which human conduct either necessarily is or (if not that, then) should be based exclusively on self-interest.
'Egotism' is more of a personal attitude than a philosophical position. An egoistic person is conceited, selfish, continually concerned with her own business and just not interested in what happens to or interests others.
This is not a complete overview but I hope it helps provide a perspective on the 'ego'.