The answer to 'what is generator' is a device that converts mechanical energy into electrical energy. Generators work by using an engine, such as a gas-powered or diesel engine, to spin a rotor inside a stator, which generates an electrical current. This electrical current is then distributed through wires to power electrical devices and appliances.
Generators are commonly used as backup power sources during power outages, to provide electricity for remote or off-grid locations, or to power construction sites and other temporary work areas. They come in a variety of sizes, from small portable units to large, industrial-scale generators that can power entire buildings or neighborhoods.