Kant argues that a person is good or bad depending on the motivation of their actions and not on the goodness of the consequences of those actions. Kant argues that one can have moral worth (i.e., be a good person) only if one is motivated by morality. In other words, if a person's emotions or desires cause them to do something, then that action cannot give them moral worth. It is then motivation as the deciding aspect of what matters. If I win the lottery and I'm with two choices with what to do either buy a yacht, travel in first class around the world, etc, or I decide that I would get pleasure if Io give the money to charity and therefore I give all the lottery money away. According to Kant, I am not a morally worthy person because I did this, after all I just did whatever I thought would give me the most pleasure and there is nothing admirable about such a selfish pursuit. Moral worth only comes when you do something because you know that it is your duty and you would do it regardless of whether you liked it.
If we then examine consequences, we can see according to Kant that they don't matter. To use another example if we picture two people out together drinking at a bar late one night, and each of them decides to drive home very drunk. They drive in different directions through the middle of nowhere. One of them encounters no one on the road, and so gets home without incident regardless of totally reckless driving. The other drunk is not so lucky and encounters someone walking at night, and kills the pedestrian with the car. Kant would argue that based on these actions both drunks are equally bad, and the fact that one person got lucky does not make them any better than the other drunk. After all, they both made the same choices, and nothing within either one's control had anything to do with the difference in their actions. The same reasoning applies to people who act for the right reasons. If both people act for the right reasons, then both are morally worthy, even if the actions of one of them happen to lead to bad consequences by bad luck.
There is a further intuitive appeal of this theory, it has the advantage that a person is totally in control of whether they are a good person. A person does not have to be in a position of power and be able to bring about good consequences in order to be a good person, all that they need to do is to act for the right reasons. This makes Kant's theory fairly egalitarian. It also explains how people with greatly differing moral opinions can still have respect for each other as people. It is not just selfishness that is ruled out by Kant's theory, but any motive at all other than morality. For instance, if you were someone who refused to break the law and you always did what the law said just because it was the law, and for no other reason (i.e., not because it is immoral to break the law), then your actions could have no moral worth. The motive of your action is in this case human law, and that is not moral law. If you follow the law for it own sake, then you would follow both good and bad laws (including any laws which might violate morality). So, even if your society happens to have only good laws, your actions still do not make you a morally good person because your motive is wrong. The same type of reasoning goes for any motive other than morality.
It can be claimed that Kant is concerned with intentions. This is I believe seems wrong. Intentions are not motivations. My intention in doing something is the goal that I intend to achieve by doing it. Intended goals (i.e., intended consequences) are contrasted with actual consequences. It is true that Kant thought that actual consequences are not relevant, but that does not mean that he thought that intended consequences are relevant. Both types of consequences are irrelevant to moral worth. If we consider the case described above about the lottery winner giving to charity. Imagine that he gives to a charity and he intends to save hundreds of starving children in a remote village. The food arrives in the village but a group of rebels finds out that they have food, and they come to steal the food and end up killing all the children in the village and the adults too. The intended consequence of feeding starving children was good, and the actual consequences were bad. Kant is not saying that we should look at the intended consequences in order to make a moral evaluation. Kant is claiming that regardless of intended or actual consequences, moral worth is properly assessed by looking at the motivation of the action, which may be selfish even if the intended consequences are good.
We can see that in the example above one of the selfish person's intended consequences is to make himself happy, and so it might seem to be that intended consequences do matter. One might think Kant is claiming that if one of my intentions is to make myself happy, that my action is not worthy. This I believe is a mistake. The consequence of making myself happy is a good consequence, even according to Kant. Kant clearly thinks that people being happy is a good thing. There is nothing wrong with doing something with an intended consequence of making yourself happy, that is not selfishness. You can get moral worth doing things that you enjoy, but the reason you are doing them cannot be that you enjoy them, the reason must be that they are required by duty.
There is also a tendency to think that Kant says it is always wrong to do something that just causes your own happiness, like buying an ice cream cone. This also I believe to be false. Kant thinks that you ought to do things to make yourself happy as long as you make sure that they are not immoral (i.e., contrary to duty), and that you would refrain from doing them if they were immoral. Getting ice cream is not immoral, and so you can go ahead and do it. Doing it will not make you a morally worthy person, but it won't make you a bad person either. Many actions that are permissible but not required by duty are neutral in this way.
Therefore according to Kant a good person is someone who always does their duty because it is their duty. It is fine if they enjoy doing it, but it must be the case that they would do it even if they did not enjoy it. It seems to me that Kants argument is strong and that he is correct in the idea that moral worth only comes from the sense of duty.