One of the major themes of the story is that a person has to follow his or her own heart, regardless of what society tells you is right.
Huck Finn has a problem. He lives in a society that condones and celebrates slavery, but he personally is not sure he believes in it. He has befriended an escaped slave named Jim, and he has to choose between following the law and following what he feels.
An excellent example of this theme is when Huck is trying to decide if he should write a note to rat out Jim. He struggles with the decision.
It was a close place. I took it up, and held it in my hand. I was a-trembling, because I'd got to decide, forever, betwixt two things, and I knowed it. I studied a minute, sort of holding my breath, and then says to myself:
“All right, then, I'll go to hell”—and tore it up. (ch 31)
This situation demonstrates how a person has to follow what he believes is right, rather than what the law or society says. This is especially the case when the law seems to be immoral, such as a law enforcing slavery. Huck does not believe Jim is inferior after spending time with him. He does not feel that it is right to rat out a friend.