First, the purpose of being with Betsy Thatcher should be simple, that is, going deep into the cave. At first, he intended to go with Ben, but he didn't want to partner with Betsy. They got lost in the cave. In the process of exploring the cave, Tom found what Injun Joe was digging. He was scared to death at that time. Later, he was rescued with Betsy. Joe fell into a deep hole and died after being chased by the sheriff.
Later, he and Huck talked about Joe in Huck's cabin. Tom was a little sad about Joe's death.
They talked about the box of gold coins that Joe dug out of the haunted house. They think Joe's gold coins should be in that cave, so they will go to that cave to look for gold coins next time.
They finally got the gold coin, Huck's fate changed, and so did Tom.