Several possible answers:
Loose connections; if it cuts off when moving this is suspect #1
Low fuel. (Generator requrires at least a quarter tank on the guage, Sometimes more)
Low oil: There is an oil level sensor as you drive oil sloshes about and may go "low"
Finally: Lack of routine mantenance: Generators should be run at least once a month for at least half an hour under at least half a load.. It can happen that they "Gum Up" and in THEORY once you run them long enough, (with the right brand of fuel) it can clean itself up a bit... and run better.. IN THEORY.
Final theory.. Gas cap.. If your fuel system is not properly vented then with the main engine running the generator may not be able to suck enough gas out of the tank as vacuum builds. the more powerful fuel pump on the main engine getting it all..
Last october I was voulenterring (for Pizza) as a "monster" on the haunted trail, my "Station" had a honda EU-2000i thet would run for just a couple of minutes then quit, lots of fuel, but it would not stay running..... Till I suggested to the guy he open the vent port on the gas cap.. That's a fully sealed system you have to open the vent or it can't suck fuel once the tank builds vacuum.
I made an offer to the park manager to haul the troublesome generator away but alas.. He felt I'd already "Fixed" it