For the square peg: if the diameter of the hole is $2r$ then the side of the square is $r\sqrt{2}$. The fraction of the area of the cross section of the hole taken up by the peg is $(r\sqrt{2})^2/\pi{r^2} = 2/\pi$.

For the round peg: if the diameter of the peg is $2r$ then the side of the square is $2r$. The fraction of the area of the cross section of the hole taken up by the peg is $\frac{\pi{r^2}}{4r^2} = \frac{\pi}{4}$.

We know that $\pi^2 > 8$ so it follows that the round peg is a better fit as it takes up more of the hole because $\frac{\pi}{4} > \frac{2}{\pi}$.