Which is better inverter or generator?

It's NOT a question of "better" . -They are different machines with different purposes. The inverter gets it's power from batteries, and is much used in submersibles and aircraft. A generator is powered by a gas motor and cannot be used in some locations.