Cognitive dissonance is a discomfort caused by holding conflicting thoughts or feelings at the same time. In this state, people may feel surprise, dread, guilt, anger, or embarrassment. Reacting to this unpleasant state, people often change their feelings, thoughts or memories so they are less in conflict.
An example is the conflict between wanting to smoke and knowing that smoking is unhealthy. For instance, a smoker might change their belief about the likelihood that smoking will make them ill, or they might introduce the idea that there are other benefits that make smoking worth it.