This person is nothing but the “I-thoughts” you have in your mind, such as “I am this”, “I am that”, “I did this”, “I will do this”, etc. That is the ego or ahamkara. As such, ego (ahamkara) is just one of the ways or modes in which the mind (anatahkarana or inner instrument) functions, the other modes being mind (manas), intellect (buddhi), and memory (chitta).
Now, the mind in its role as ego ascribes the functions of mind and body to itself, thinking it is the doer of bodily actions and the thinker and feeler of thoughts and emotions. This sense-of-doership is the whole crux of the matter in that as long as one thinks one is the doer and thinker-feeler, one is bound to karma and its results.
The thing to realize is that the body and mind being mere names-and-forms are being run not by themselves but by some other force, namely, the underlying substance of the name-and-form of body-mind, which is nothing but Consciousness or God. Consciousness or God is the doer and not the body or mind.
This realization or understanding has to occur in the mind. Then, such a mind becomes Sattvic, and Rajas and Tamas take a backseat. Such a mind grasps its true underlying reality behind the person it now thinks it is. That underlying reality is nothing but Consciousness or God – Tat Tvam Asi.
So, the ego, or the person we think we are now, is nothing but just thoughts in the mind, and such a person is a mere imagination put together by thought and memory because as we have seen the only reality is Consciousness or God and not the body-mind which is mere name-and-form. Hence, the ego is a mere illusion.
When the mind understands this Truth and dwells on it constantly (Nididhyasana) the veil of ignorance is lifted and one realizes the Truth.