The categorical imperative is essentially a law or command that everyone is affected by. It is a moral hypothetical that allows a person to distinguish what is "moral".
For example, the classic example of a categorical imperative is if there is a law that "Everyone can murder one another." This is a moral hypothetical that we can tell is immoral because of how murdering one another leads to a very dangerous society. If everyone could murder each other, nobody would be alive in this hypothetical, causing the end of society. As we want society to continue and prosper, this categorical imperative allows us to support the idea that murder is immoral.