How exactly does karma work?
A complex topic, but I will try to give the basics and make some points.
First, let's understand what creates karma from the Vaishnava perspective. In the Bhagavad Gita (Chapter 4.16-23), Krishna explains that are three different types of work:
- akarma, which is work done in pure consciousness, which produces no karma
- karma, prescribed work, which accrues either good or bad karma (work produces fruit),
- vikarma, or forbidden activities.
The goal is to perform all our activities in transcendental consciousness, which creates no karma or akarma. Good karma and bad karma do not balance each other out. They are like two different bank accounts, and the money in both will have to be spent.
One cannot escape the cycle of birth and death unless one is completely free from karma. Krishna again explains this in Bhagavad Gita 4.20:
Abandoning all attachment to the results of his activities, ever satisﬁed and independent, he performs no fruitive action, although engaged in all kinds of undertakings.
Srimad Bhagavatam (5.5.5) also states:
As long as one does not inquire about the spiritual values of life, one is defeated and subjected to miseries arising from ignorance. Be it sinful or pious, karma has its resultant actions. If a person is engaged in any kind of karma, his mind is called karmātmaka, colored with fruitive activity. As long as the mind is impure, consciousness is unclear, and as long as one is absorbed in fruitive activity, he has to accept a material body.
As far as the next body, that is governed by the state of the consciousness at the time of death. See Bhagavad Gita 8.6:
Whatever state of being one remembers when he quits his body, O son of Kuntī, that state he will attain without fail.
There is also mention of this later in the Gita in chapter 14. What you're referring to in "if you're bad, you will become a bug," there are specific references to what type of birth you will take if you commit certain actions, and these are mentioned in numerous Puranas, but it is rather complex.
Note: “The question: How exactly does karma work?” is licensed by Stack Exchange Inc (https://hinduism.stackexchange.com/); user contributions licensed under CC BY-SA.