From the first moment of the novel, Tom is on the run, hiding out from Aunt Polly with stolen jam smeared across his face in her closet. In the face of constant scolding and ever-boring work, Tom repeatedly manages to escape. He plays hooky whenever possible, and leaves Aunt Polly's house typically to return only after his bedtime. He also metaphorically escapes from the boring routines and rules of daily life in St. Petersburg through fantasy, re-imagining the world to entertain himself. This might involve play-acting with other boys, or exaggerating his own achievements. He collects superstitious beliefs and tokens—typically everyday cast-off objects reinvented—with which to flavor his tall tales.
Tom draws from books he's read about Robin Hood, pirates, and other adventurers to imagine himself as the hero of a romantic tale and thereby view his everyday woes in a more glamorous light. His maturation over the course of the novel, however, largely involves his learning to differentiate this romantic world from reality. He begins to develop this ability when he runs away with Huck Finn and Joe Harper to Jackson Island, his first "real" physical escape from St. Petersburg. The boys create an alternate reality on the island, with new names and histories for each of them. Their island adventure reveals the fun to be had in escaping through rule-breaking, as the boys leave the strictures of society behind altogether, parading around naked and even abandoning their families by allowing them to believe they've drowned. They learn, however, that no escape is permanent, feeling homesick rather than courageous on the island. Only upon returning to the warm embrace of the villagers who thought them dead do the boys come to feel heroic. At the novel's end, Tom no longer feels the same longing to escape St. Petersburg, and even chastises Huck for running away from the widow Douglas's home, insisting that he return there if he want to join Tom's new gang. Tom has matured into an adult who, like the rest of his community, takes pride in his new wealth and status, and his clever ability to manipulate others will now serve him as he assumes a leadership position as an adult in St. Petersburg (as a lawyer, if Judge Thatcher has his way).
The adults of St. Petersburg are themselves susceptible to flights of fancy—consider the minister's extraordinary descriptions of the apocalypse in his church sermon. Twain's depiction of Tom's playful games are delightful to read over the course of the novel, and while he must gain a more realistic view of life as an adult, Twain suggests fantasy provides a way for people to handle the harshness of reality.