Kant believes that moral actions are rational actions. To act morally is to act rationally. We can perform all sorts of actions that may seem moral on the face of it, but if they're not carried out on the basis of reason, then according to Kant they're not really moral. Whenever we act, we have to think of what we do as being a universal principle, one that would apply to everyone else, whatever their individual circumstances. When we come to judge our moral actions, Kant thinks we have to ask ourselves the following question:
Can I rationally will that everyone act as I propose to act? If the answer is yes, then it is a moral action; if not, then it isn't.
Take lying, for instance. Kant argues that lying can never be rational, and therefore moral, because it can't be a universal principle. Whenever we lie, we should imagine what it would be like if everyone else did the same thing. We'd soon come to realize that it would be impossible to have a society if everybody lied whenever they felt like it. We'd never be able to trust anyone; contracts would mean nothing; true friendship would be impossible; and the whole structure of society would surely collapse.
What is moral is good in itself, irrespective of its consequences. In acting morally, we are obeying the dictates of our capacity to reason, something we as humans all share. Reason commands us to act in a certain way; it is an imperative. But reason is also autonomous. This means that we are essentially acting according to a law we've given to ourselves; and we do this after a process of rational thought and deliberation. We don't depend on anyone else to give it to us; we discover it by looking inside ourselves.
Now this doesn't mean we can be a law unto ourselves, doing whatever we like. Remember what we said earlier: only those actions are moral that can be applied to everyone. Clearly, if we went round doing whatever we wanted—say, getting drunk, breaking the law, hurting other people—then those actions couldn't be universalized for the exact same reason as the act of lying.