I believe it would be safe to say that the theme of O. Henry's story "After Twenty Years" is an old one: Crime Does Not Pay. O. Henry contrasts two different characters who have two different philosophies and two different value systems. Bob is greedy and materialistic. He wants to make a lot of money, buy a lot of things, enjoy a life of luxury, and display his success conspicuously. And he doesn't care how he gets the money as long as he gets it. Jimmy is conventional and conservative. He wants a good steady job that is socially useful. He wants a home and a family. Jimmy is probably a staunch Irish-Catholic who takes his wife and children to church every Sunday.
The two men's different philosophies take them on different paths until they finally meet again after twenty years. Jimmy has a good steady job that is useful to society. He likes his work and he has security. When he retires he will receive a pension for the rest of his life. Bob, on the other hand, has made a lot of money through crooked means. But he has no home, no family, no security. The money hasn't really done him much good. He has spent some of it on a scarf pin with a big diamond and a pocket watch decorated with small diamonds.
It is important to him to have other people look at him, to admire and envy him. But he is always on the run, and it is probably inevitable that he will end up in prison sooner or later. In O. Henry's story Bob discovers that he can't even trust the man he thought was his best friend. Bob has no friends because he never stays in the same place long enough to acquire friends, and also because he is not the kind of man that decent people would want to have as a friend. His flashy lifestyle has made him conspicuous, easy to identify wherever he goes. His career ends up with his being led off to jail. If he has a whole string of crimes charged against him in Chicago and elsewhere in the West, he could be spending a long time in state prisons. Crime really does not pay.