Tom’s well-behaved yet vindictive brother Sid highlights all of the ways that Tom rebels against authority, making him a foil. For example, when Tom plays hooky from school, Sid tells on him for doing so. When Tom neglects to say his prayers one night, Sid “made mental note of the omission.” Sid’s presence inspires Aunt Polly to compare the boys, which leads her to find Tom wanting, such as during the scene when she raps Tom on the knuckles for sneaking sugar:
He said: “Aunt, you don’t whack Sid when he takes it.”
“Well, Sid don’t torment a body the way you do. You’d be always into that sugar if I warn’t watching you.”
Presently she stepped into the kitchen, and Sid, happy in his immunity, reached for the sugarbowl—a sort of glorying over Tom which was well-nigh unbearable.
Though Sid is regaled as the perfect child by Aunt Polly, Twain makes it clear in moments like this that Sid doesn’t always follow the rules and can also be quite cruel. In a different scene, when everyone in the village believes that Tom, Huck, and Joe are dead (while they are hiding at Jackson’s Island), and Aunt Polly is reflecting on how much she misses Tom, Sid says, “I hope Tom’s better off where he is, but if he’d been better in some ways—.” Aunt Polly immediately reprimands him, but his unkind words still hang in the air. Sid’s cruelty shows how following the rules doesn’t necessarily make someone a “good” person.
Throughout the novel, Huck Finn is a foil for Tom, meaning that his presence is used to reveal information about Tom. While Tom acts rebellious but returns to a safe home and a loving aunt at the end of the day, Huck is truly an outcast—he has no home, no parents (his mother is dead and his father is an alcoholic who often disappears), and he doesn’t even attend school. Twain describes how Huck’s status as a social pariah is precisely what makes parents afraid of him and boys like Tom want to spend time with him:
Huckleberry was cordially hated and dreaded by all the mothers of the town, because he was idle and lawless and vulgar and bad—and because all their children admired him so, and delighted in his forbidden society, and wished they dared to be like him. Tom was like the rest of the respectable boys, in that he envied Huckleberry his gaudy outcast condition, and was under strict orders not to play with him. So he played with him every time he got a chance.
Huck’s embodiment of freedom from social constraints inspires Tom to crave that kind of freedom, too, propelling him to run away from home and live on Jackson’s Island with Huck and Joe for a short time. Still, while Huck is content to stay on the island, Tom and Joe crave the comforts of home. In this way, Huck’s presence highlights all of the ways that Tom is part of normal society even as he believes himself to be a rebel and an outlaw.
While Tom is seen as “bad” in the sense that he disobeys Aunt Polly’s (and his teacher’s) orders, he is nowhere near as “bad” as Huck, who, as the quote says, is categorically bad simply because he refuses to comply with certain social standards. It is important to note that Twain is mocking the hypocrisy of adult society here—he does not consider Huck to be bad (as evidenced by his decision to go on to write The Adventures of Huckleberry Finn), but sees the ways that judgmental, self-righteous adults (who claim to be moral and pious) abandon a boy who has already been abandoned.
Injun Joe reveals that all of the romantic adventures Tom dreams about having (robbery, treasure-hunting, living life outside of authority, etc.) are not as lighthearted as they look, making him a foil for Tom. While Tom imagines himself to be an outcast in trouble with the law, Injun Joe actually is, and his life is not enviable—there are real consequences for the ways in which he impulsively murders people and hunts for treasure (namely, that he is hunted down and eventually dies).
As a foil, Injun Joe reveals the terror and violence of engaging in the fantasies that Tom romanticizes. His presence pushes Tom toward maturing into a young man who does not crave this kind of intensity, as seen in the moment in which Tom realizes Injun Joe has died:
His pity was moved, but nevertheless he felt an abounding sense of relief and security, now, which revealed to him in a degree which he had not fully appreciated before how vast a weight of dread had been lying upon him since the day he lifted his voice against this bloody-minded outcast.
Tom feels relief about Injun Joe’s death because, after testifying against Injun Joe and feeling terrified of his vengeful wrath, Tom can go back to feeling safe from any real or consequential adventures. He is grateful to be free of the type of life he always claimed to have wanted, and he has grown up in the process (as seen by the end of the novel, when he settles into normal society and encourages Huck to do so with him).