Asmita is egoism that leads to false identification with mind and intelligence. Ahankara is egoism which leads to identification to 'I' and 'mine'.
asmitā (‘sense of “I exist”,’ ‘egoism’)
The Yogasūtras of Patañjali (200 B. C.) defines yoga as the
suppression of the citta-vṛttis or the modifications of the mind.
Among these modifications one group is called ‘kliṣta’ (‘the
afflicted’). These ‘kleśas’ or afflictions are again listed as five,
of which ‘asmitā’ or egoism is the second (2.3). It has been defined
as the false identification of the seer or the Self, called dṛkśakti
or puruṣa, with the instrument of seeing viz., the buddhi (intellect
or mind) (2.6). When the puruṣa who is really asaṅga or unattached and
free, thus gets identified with the mind, he experiences happiness and
misery resulting in bondage. Due to this reason asmitā is called a
kleśa, an affliction, which is an obstacle to yoga.
A Concise Encyclopedia of Hinduism by Swami Harshananda
ahaṅkāra(‘egoism’)
Ahaṅkāra is that which produces abhimāna, the sense of ‘I’ and ‘mine.’
According to Sāṅkhyan metaphysics, a large part of which is accepted
by Vedānta, ahaṅkāra is the principle of individuation that arises
after mahat or buddhi in the process of evolution from prakṛti
(nature). It is regarded as a substance since it is the material cause
of other substances like the mind or the sense-organs. Through its
action the different puruṣas (individual selves) become endowed each
with a separate mental background. These puruṣas identify themselves
with the acts of prakṛti through ahaṅkāra.
At the individual level it makes the puruṣa feel that he is receiving
the sensations through the senses and the mind, and deciding about
appropriate action, through the intellect.
At the cosmic level, the five senses of cognition (jñānendriyas), the
five organs of action (karmendriyas), the mind (manas) and the five
subtle elements like the earth (tanmātras) are produced out of
ahaṅkāra.
In some works of Vedānta, ahaṅkāra is considered as a function of
antaḥkaraṇa (internal instrument or mind), responsible for ego-sense
and possessiveness.
Ahaṅkāra as egoism or self-conceit is considered as a great obstacle
in spiritual life and the cultivation of humility is prescribed as its
antidote.
A Concise Encyclopedia of Hinduism by Swami Harshananda