Generator is an electromechanical device (power generator) while inverter (UPS) is a power electronics device.
Generator is used to generate electricity in Our house, industries and office require AC current, In power station AC is generated using alternator (AC). This electricity is then transferred over long distance all the way to our home, industries, office etc. So that’s generator.
Another kind of generator which I think you want to know about is diesel generator. These are large and machines which has a generator whose shaft is coupled with a diesel engine. This generator does the same thing i.e, generates electricity at the cost of fuel (diesel, petrol) when there is power outage.
Inverter on the other hand, is a power electronic device which has only one basic purpose to convert DC (direct current) to AC (alternative current). In case of inverter used in home, industries, office, the AC power is first converted to DC using rectifier and then stored within a rechargeble battery. The power required in house purpose, industries and office is AC while the stored one is DC. Here comes the role of an inverter which converts this DC to AC and hence makes the stored power usable. In case of inverters, no external source of energy is required to operate. It stores the power when there are normal power conditions and once there is power outage, the inverter acts as an auxiliary power source.
Inverters, compared to there diesel-generators counterpart is more efficient, clean and reliable. These do not cause noise or environmental pollution.
These are the differences between inverter and generator.