The sine wave is a natural function of the rotary nature of generators.
Inverters can more easily make square wave but this has many other frequencies included in the waveform. These additional frequencies cause unwanted noise and heating in many of the connected loads, especially motors and trasformers.
This is a very simplistic explanation based on your simple question.
regards
Chas
__________________
En la casa del herrero, cuchillos de palo!