Hypothetical imperatives are conditional: if you want X, do Y. They apply only to those with a particular desire. The categorical imperative is unconditional: it applies to all rational beings regardless of what they happen to want. This is what makes it moral rather than merely strategic.
To test an action, identify the maxim behind it — the principle you are acting on — and ask whether it could be universalised without contradiction. Consider lying to get out of a difficult situation. If everyone lied whenever convenient, the very institution of communication would collapse. The maxim is self-defeating when universalised.
Kant offers a second formulation: act so that you treat humanity, whether in your own person or in that of another, always as an end, never merely as a means. This prohibits using people as instruments for your purposes without regard for their own rational agency. It grounds a theory of human dignity independent of consequences.
Critics from J.S. Mill to contemporary consequentialists argue that Kantian ethics can produce absurd results — demanding honesty even to a murderer asking where your friend is hiding. Kant himself bit this bullet, maintaining that lying is always wrong.