Yoga Sutras 2.6
Patanjali, explained by Swami Vivekananda
दृग्दर्शनशक्त्योरेकात्मतेवास्मिता ॥
dṛgdarśanaśaktyorekātmatevāsmitā
Egoism is the identification of the seer with the instrument of seeing.
In plain words: Ego means confusing the one who sees, our true Self, with the tools it uses to see, like the mind and senses. The teacher explains that when we say "I am angry," we are mixing up our Self with a passing mood.
Swami Vivekananda explains
The seer is really the Self, the pure one, the ever holy, the infinite, the immortal. This is the Self of man. And what are the instruments? The Chitta or mind-stuff, the Buddhi or determinative faculty, the Manas or mind, and the Indriyas or sense-organs. These are the instruments for him to see the external world, and the identification of the Self with the instruments is what is called the ignorance of egoism. We say, "I am the mind," "I am thought," "I am angry," or "I am happy". How can we be angry and how can we hate? We should identify ourselves with the Self that cannot change. If It is unchangeable, how can It be one moment happy, and one moment unhappy? It is formless, infinite, omnipresent. What can change It? It is beyond all law. What can affect It? Nothing in the universe can produce an effect on It. Yet through ignorance, we identify ourselves with the mind-stuff, and think we feel pleasure or pain.