When your child disobeys, you punish him. WHY?
Simple answer: So he will listen next time and won't disobey again.
If the child has a learning disorder and is incapable of learning from the punishment, odds are you will stop punishing him and will deal with his condition in other ways.
We punish children in order to change their behavior. If the punishment does not promote a change in behavior the punishment is useless and possibly evil.
When a criminal disobeys, we punish him. Why?
Simple answer: To discourage others from doing the same thing, and possibly to convince him to not do it again.
If the man has a mental disorder and was not in control of his actions, it still does the rest of society good to lock him up or rehabilitate him so that he cannot bother us anymore with his crimes.
It doesn't do HIM any good since he won't learn from it, but it does the rest of society a benefit by removing a harmful or dangerous force from the general population.
When a person sins, god sends him to hell AFTER HE DIES. Why?
Simple answer: I have no idea.
It cannot make him change his behavior since he has already died. It's not like he can commit the same crime again if he tried since he already did it all the times he possibly could. It doesn't protect anyone from him since you let him get away with it until he died, so if he was gonna go on a murdering rampage for 40 years, punishing him AFTER the fact does no good. You should have stopped him BEFORE or DURING the rampage.
If the goal is to prevent others from sinning by his example, then it fails in that regard as well since it only happens in some other invisible dimension after he's already died. So none of us can learn from his example.
What good does it do? And by 'good' I mean: Has a generally positive benefit for some intelligent being.