What is the difference between ego and selfishness?
Ego is not selfishness. Selfishness has nothing to do with ego. Both selfishness and selflessness (altruism) are egoic traits for as long as it matters to you to be seen that way.
True selflessness (egolessness) is also absolute selfishness. You can only be truly giving when you realize that you’re not doing it for others - you’re doing it for yourself. Just because you like it. Then your giving is genuine. For as long as there remains an expectation (including an expectation of gratitude), your giving is transactional, and most altruistic people care to be seen as such. There’s nothing wrong with that, but associating ego with selfishness and egolessness with altruism is one of the biggest mistakes people make.