Hypocrisy is claiming a virtue or belief you do not actually hold — a charge about you, whether or not anyone is watching. Dissonance is the clash between your own cognitions, and the private discomfort that clash produces — and the difference matters, because dissonance is a normal mental state everyone experiences, not an accusation.
Side by side
Aspect
Cognitive dissonance
Hypocrisy
Is
A feeling
A judgement
Who notices
You
Someone else
Moral weight
None
Accusatory
Universal?
Yes
No
What each one means
Cognitive Dissonance
Cognitive dissonance is the discomfort you feel when two of your beliefs conflict — or when what you did doesn't match who you think you are — and the pressure that discomfort creates to make the mismatch go away.