Strictly speaking it’s octagonal, but who’s counting?
There’s actually a method here.
It is easier to make a round hole (drill) than a square hole ( chisel). On the other hand, it is easier to make a square peg (saw) and a round peg (lathe).
Also it would be hard to fit the exact size peg to the exact size whole. So you cut a peg with flat sides, where the diagonal is slightly larger than the diameter of the round hole. You sharpen one end like a pencil and drive it in with a mallet and it fits tightly, with any excess peeling off the corners.