Do you have more than one GFCI outlet in the RV? And if so, does it also trip?
A GFCI outlet functions by comparing the amount of current flowing in the hot pin to the amount of current flowing in the neutral pin. They should be exactly the same. A difference of around 4 milliamps will trip the GFCI outlet. That difference means some of the current flowing into one pin is not reaching the other pin, i.e. some is “leaking” out somewhere. To be leaking out means it has to be reaching the power source (generator or shore power) via a ground path bypassing the outlet. And since ground and neutral are bonded at the source, that leakage gets back to the source neutral.
This makes me wonder if your generator ground is grounded to your trailer. Or your generator neutral is not bonded to generator ground. GFCI tripping when connected to shore power indicates you have a ground fault in one of your circuits or something plugged into one of those circuits. Not tripping on generator seems to indicate no ground path back to generator neutral.