Two related ideas describe how the past lives on in the mind.
A mental impression (Samskara) is the groove left by a past experience, the reason a reaction can feel automatic before you have chosen it. Every time you run a pattern, the groove deepens. Practice works directly with samskaras: not by force, but by laying down new, cleaner grooves until the old ones quieten.
A deep tendency (Vasana) runs deeper still: the accumulated shape of character, the inherited flavour of how a particular mind tends to move. Many samskaras of a kind settle into a vasana.
Together they are why change is slow but real. You are not fighting a single thought; you are re-grooving a riverbed. The law that carries these grooves forward is Karma; the habit mechanism in practical, daily form lives at Pratyahara.