Tom, who has a very vivid imagination, generally dreams about leading an exciting life of adventure far away from his real life in the prim, respectable, sleepy little town of St Petersburg. His imagination has been nurtured on books of adventure and romance and he constructs his fantasies according to such books.
Tom is able to enact some of his fantasies with close friends like Joe Harper and the town outcast, Huck Finn. For instance, he and Joe play out various scenes and characters from the story of Robin Hood. Afterwards they turn back to their real life with regret:
The boys dressed themselves, hid their accoutrements, and went off grieving that there were no outlaws any more, and wondering what modern civilisation could claim to have done to compensate for their loss. They said they would rather be outlaws a year in Sherwood Forest than President of the United States for ever. (chapter 8)
The boys' adventures, then, are set in deliberate counterpoise to the coventions and customs of 'modern civilisation'. Perhaps the most notable, and certainly the most sustained example of this in the book is when they run away to Jackson's Island to be pirates. They adopt blood-curdling pirate names and spend several days living a free, untrammelled life in the wild. Indeed, for these few days, the people of St Petersburg believe them to be literally dead.
Finally, though, the boys do return. However wild Tom's dreams, and however he might chafe against the restrictions of St Petersburg life, he never quite repudiates his ties to society. In fact, he and the other boys suffer acute homesickness on the island and are glad enough to return in the end.
Nothing can ever quite rein in Tom's dreams and imaginings, however. Even after having some all-too real adventures when trapped in the caves with Becky, encountering the dangerous villain, Injun Joe, and finding treasure, at the end of the book we still see him planning to form a robber gang with undimmed enthusiasm.