"The Devil and Tom Walker" explores the darker side of human nature. Tom is an exceptionally greedy person, but the temptation for money that he succumbs to is one that haunts most humans. That makes the story relatable, even if we don't particularly like Tom.
Tom is a very human character in that he wants to have life both ways, which provides another point of commentary on human nature. We all, at one time or another, imagine that we can step over a moral, ethical, or legal line and get away with it. We think we are the one who is smart enough to take a risk, get ahead, and not have to pay the price.
This is what happens to Tom. He is pleased to make a deal with the devil when death is far off and pleasure is immediate. As is true of human nature, Tom tends to react to what is closest at hand. He finds it is easy to grasp an immediate pleasure while somehow thinking that he can avoid—or at least forget about—the future payback.
When Tom begins to realize that he is getting older, he tries to wiggle out of a deal that no longer looks so good to him with death perhaps looming. It occurs to him that perhaps he can enjoy all the devil has given him in terms of wealth and power while cheating the devil of his due. Therefore, Tom starts going to church in the hope that it might offer him salvation. Ironically, however, it provides none because he doesn't understand the essence of truth, charity, and lovingkindness, so he merely brings his hateful and judgmental self into the building. He is the devil's minion in church and out.
Finally, as is also true of human nature, Tom doesn't derive much happiness from what he thought he most wanted, which was money. Despite all his wealth, he lives in a joyless, miserly way.