Kant's approach to ethics and moral philosophy is based on the idea that the Categorical Imperative (CI) defines what is good or right and what is bad or immoral. The CI is based on the inherent ability within each person to distinguish between moral and immoral actions. Kant argues that this ability is naturally present within human beings and based on rational thought. This is in contrast to the view of human beings as animals governed by passion and impulse.
Kant sees duty as a person's charge to act based on the CI present within each person. If a person believes an action to be good according to their internal, rational beliefs, then it is their duty to act on it. If they believe an action to be immoral or irrational (which Kant argues go hand-in-hand), it is their duty not to act on it.
Other definitions of duty often focus on a person's duty to another person, organization, governing body, or principle. Duty according to Kant is internally focused, with the CI being the ultimate litmus test of whether a person has a duty to act or not.
Kant does recognize the duty a person has to rules and laws put in place for society to function. However, a person's duty to behave morally overrides any duty or obligation they have to follow external rules and laws. Laws put in place by governments and societies are often in line with moral and ethical standards because they allow society to function, making a person's moral duty and civic duty compatible. But this is not always the case. One key example is the argument that German soldiers in World War II had a moral duty to oppose the genocide committed during the Holocaust more than they had a duty to follow laws or orders given to them by military and government authorities.