As far as the reason for writing the book is concerned, Samuel Clemens (aka Mark Twain) makes it clear in the preface of the first edition where he says:
"Although my book is intended mainly for the entertainment of boys and girls, part of my plan has been to pleasantly remind adults of what they once were themselves, and what they felt and thought."
The book is definitely an entertaining read and has enthralled young and old through the ages. It effectively succeeds in bringing back thoughts about what one had been like and up to, as youngsters. Readers can also identify with what the characters do, depending of course, on his or her own history and background.
In its purpose, the book seeks to explore the romance and intrigue of growing up, and acts as a sort of semi - bildungsroman, by tracing the lives of the protagonists and exposing the lessons they learn as they head towards adulthood and maturity. The characters are faced with many situations in which they are entirely reliant on their own intellect and ability to overcome some or other conundrum. In the story, they succeed admirably. The purpose then, is to also teach, especially young readers, that they can overcome adversity in whichever form it may present itself - such as for example, Tom and Becky's escape from the cave.
In this, therefore, the story is not a mere narration applicable to Americans only, but it has universal significance and appeal.
Furthermore, the narration also displays Twain's subtle criticism of the habits, beliefs and general demeanour of Americans at the time. He takes a particular stab at religion where he satirizes for example, one character's memorisation of Bible verse, in order to obtain a reward.
He once recited three thousand verses without stopping; but the strain upon his mental faculties was too great, and he was little better than an idiot from that day forth—a grievous misfortune for the school, ...
In other examples, he criticizes the gullible nature of humans, who naively support causes without thinking clearly and rationally, almost like sheep being led down the garden path. One is where Tom, for example, persuades his friends to paint a fence for him, with the promise of reward.
He had had a nice, good, idle time all the while—plenty of company—and the fence had three coats of whitewash on it! If he hadn't run out of whitewash he would have bankrupted every boy in the village.
Another pertinent example of this is when adults in the town petition for Injun Joe's release. It was thought that he had already killed five citizens of the village:
"... but what of that? If he had been Satan himself there would have been plenty of weaklings ready to scribble their names to a pardon petition, and drip a tear on it from their permanently impaired and leaky waterworks."
The novel also ha a semi-autobiographical nature, especially in its setting. The story is set in an area in which Samuel Clemens grew up. The author grew up in Hannibal, Missouri, which was a quiet town overlooking the Mississippi River. The town is renamed St. Petersburg and is where all the characters live. The Jackson's Island of Tom Sawyer is an existing landmark situated south of the town, close to the Illinois side of the river.
The cave that was Injun Joe's hideout, still exists, as do the houses whic Widow Douglas and Aunt Polly supposedly resided in. Twain's town was surrounded by large forests which he himself knew as a child and in which his characters Tom Sawyer and Joe Harper often play, "Indians and Chiefs." All of this adds to the realism of the narrative.