It's due to their function. Lots of people make the mistake of viewing it as a moral category and judge each cop individually as a result rather than as an organ of capitalist state power, and their own survival hinges on fulfilling this function and following state orders (because wage labor).
John from your neighborhood might be a nice guy and a good cop, but if there's ever a serious enough general strike, he'll be there to beat up the workers.
