The easiest way is to fit a chuck to the rotary table. It centres jobs like your chuck key on the table's axis, making it straightforward to cut the four faces of the square with a milling machine. Might be possible to attach your lathe's chuck, but chucks for rotary tables usually have four bolts passing through the chuck's body so they can be undone from the front. The bolts engage with T-nuts in the rotary table's slots. If you haven't got a suitable chuck, welcome to the wonderful world of model engineering, in which there's always some new accessory wanted!
Rotary tables shine when other than right angles are needed, otherwise not essential because other methods produce right angles. I made my chuck keys by gripping the shaft in an vice on the milling table with the end sticking out enough to receive the end of the milling cutter. After the first flat was cut, I turned the shaft 90 degrees in the vice and used a set-square against the face to get it exactly* vertical. Then cut the second and other faces in the same way.
If you don't have a machine vice, the shaft can be clamped directly to the milling table. It's a little more bother adjusting it compared with a vice.
*exactly needs some qualification. A casually used set-square will get close enough to 90 degrees for most purposes, but on this job the short face length and fiddling with the shaft in the vice limits accuracy. The vice problem is much reduced if it already has a V-slot jaw, or V blocks are used, to keep the shaft horizontal. Good news, chuck keys don't need to be anything like accurately square! I wouldn't risk it, but I'm sure our more accomplished brethren could eyeball a good enough square end on a chuck key, not just with a milling machine, but by hand filing it in a bench vice.
Work-holding, especially of odd shapes, is a skill in it's own right.
Dave