A generator is a device that creates electricity from some other form of energy. In RV terms this usually means a gasoline powered generator, but they can also run on propane or diesel.
Note: in some areas solar setups and wind turbines are also called “generators”.
The most common built-in generator is the Onan, now owned by Cummins.
Middling brands include Generac,
The lower end is dominated by Champion gennies, which are loud but cost 1/3rd as much as Japanese models.
It is common to leave generators quiet in times of darkness, and to not run them when close to other campers.
Generators are not particularly well-suited to charging lead-acid batteries (flooded, sealed, AGM, etc) on their own. They work best in combination with solar; the generator handles Bulk charging and solar handles the long-duration, low-current Absorption and Float stages.
[Alternator charging + solar can do the same thing for about $950 less – Secessus]
If the generator is being used for some other purpose then by all means add on battery charging. But running a generator for hours at 5% capacity only for charging is not optimal.
Generators are well suited to charging lithium-chemistry batteries as that type can take current at all points of charging.
Generators generally have a minimum amount of wattage they can produce. This means that until you hit that minimum multiple loads can be run for “free”, speaking in terms of fuel consumption.
An example of an efficient use would be: