You need to understand Vedanta physiology first. A Person is considered to be an Atman covered by karana sarira (causal body), sukshma sarira (subtle body) and sthula sarira (the gross body). The gross body is the outermost covering of the Atman while the causal body is the final covering of the Atman.
Now that we understand the physiology, we have to know how one attains Moksha. According to the sage Vasishta in Mahabharata Santi Parva Sectiom CCCVII:
When men of knowledge, conversant with the rules of Yoga, become as
fixed as a stake of wood, and as immovable as a mountain, then are
they said to be in Yoga. When one does not hear, and smell, and taste,
and see; when one is not conscious of any touch; when one’s mind
becomes perfectly free from every purpose; when one is not conscious
of anything, when one cherishes no thought; when one becomes like a
piece of wood, then is one called by the wise to be in perfect Yoga.
At such a time one shines like a lamp that burns in a place where
there is no wind; at such a time one becomes freed even from one’s
subtle form, and perfectly united with Brahma. When one attains to
such progress, one has no longer to ascend or to fall among
intermediate beings. When persons like ourselves say that there has
been a complete identification of the Knower, the Known, and
Knowledge, then is the Yogin said to behold the Supreme Soul.
Let me draw attention to the bolded portion 'freed from one's subtle form'. The main purpose of any spiritual practice is to go beyond the subtle form or to punch a hole through the subtle covering. This can be achieved through devotion to a Devata (theistic approach) or through knowledge of one's own nature (Jnana marga) or through one's own effort ( strict Buddhistic approach) or through mantra japa etc. After one has broken free of the subtle covering then one has to break free of the causal covering to reach the Atman. When one becomes freed from the subtle covering, the mind becomes an useless appendage and basically does not work. That is why they say that an Yogi has to fix one's mind when he does not notice anything.
You may be wondering what this has to do with bad Karma. What bad Karma does is to injure one's subtle covering so that it becomes very difficult to punch through that covering. Good Karma makes the job of breaking free from the subtle covering easier.