The industry term for this is called "polygon turning".
The cutter has to spin at a ratio compared to the main spindle, and the ratio is determined by how many flats you want on the part, and how many teeth your cutter has. For example, a 3 tooth cutter will need to spin at a 1:2 ratio (so twice as fast) relative to the main spindle to achieve 6 flats. If you cranked that up to a 1:3 ratio, you'd get 9 flats on the finished parts. Basically Number of Flats = (Number of Teeth * Speed Multiplier).
Polygon turning is super cool, and it's a very fast way to crank out parts with hex or square (or any polygon shape really) features using lathes. It's used very often in the high production world.
However it's not perfect. The flats are not perfectly flat, and actually have a radius (or rather an ellipse) shape to them. So if you put a straightedge up to it, you'd see they're slightly dished. IIRC, the error gets worse the less flats you have, and the smaller diameter your cutter is. For most applications, the error isn't a problem. Although I suspect in this guy's case, his universal joints are probably adding some additional error. Likely not a big deal if you just want the flats to put a wrench on it.