It's not entirely broken, just severe. There are two ways dwarves become criminals: violating production orders (which is somewhat random, as no matter what the item mandated was, most of the time the dwarf selected to be punished will have no skills related to its production) and tantruming, which results in vandalism, building destruction, and fights. There are two possible punishments for crime in a fortress: beatings and imprisonment. If there is no where to imprison criminals, all sentencing reverts to beatings. Your sheriff or fortress guard will mete out justice however they can, with whatever they have on hand.
In order to make justice less lethal, you can do a few things. First of all, build a jail. The simplest jail is a room with some ropes, chains or cages in it, designated as a room from one of the cages/ropes, and set to be "used by justice". It's advised to keep your prisoners happy, since if they keep throwing tantrums, they'll never get out of prison. Therefore, since you want your prison to look nice, chains are the best choice, usually of some valuable material so the prisoners have something nice to admire. Adding beds, food and booze stockpiles, and even a chair and table can keep prisoners happy (and if your manager or bookkeeper get imprisoned, they can still work if there's a chair available). Even smoothing the walls and floors helps. With any sort of jail in place, your guard won't have to resort to corporal punishment all the time. (Things like murder and multiple offenses at once will still sometimes warrant a beating.)
Secondly, the cotton candy axe you've handed your guard captain was a death sentence for those dwarves. A warhammer of the same material is next to harmless, usually only bruising its victims. They'll heal quicker, and you won't have to worry about their friends getting upset and asking for a beating of their own.
What happened was those dwarves had been selected for punishment by a noble, probably your mayor, when you missed a couple mandates, or they had been tantruming and knocked something over. You can check the crimes your dwarves have committed, as well as any unfulfilled punishments that are lines up, by going to the status menu ('z') and opening the Justice menu. When you assigned a guard captain, he went out to deliver the punishments that had been long overdue.