There is a possibility that your UPS doesn't like the voltage or frequency that the generator is feeding it. As per an APC knowledgebase article, the size of a generator should be 3 to 5 times higher that the total Watt/VA load that it would be supporting.
There are also instances wherein the sensitivity threshold of an APC BackUPS is set too high that a slight change in voltage/sensitivity would cause the unit to switch from online to on battery too frequently. This can be addressed by lowering the sensitivity either by their APC PowerChute Personal Edition Software or via the front panel switch.
If you are going to do it via the software, it needs to be installed on your computer. Prior to downloading it, make sure that your operating system is compatible with it. Suppose that your operating system is compatible, once the program is installed you will need to open it up and look for the Sensitivity option and from there you could select Low, Medium or High.
If you are going to do it via the front panel switch/button the UPS should then be turned off but plugged in to an input source. Press and hold the On button until you see that the LEDs are flashing. Once the LED is flashing, press the button again to set the desired sensitivity. Low sensitivity would show the On Battery LED flashing. Medium is On Battery and Overload LED while High is On Battery, Overload and Replace Battery LED flashing. If you'll see a flashing Online LED it means that you are cancelling or exiting the program mode of the UPS.
Below are some helpful links from APC
*** You will need to login in APC before you can download the software. Choose the correct PowerChute Personal Edition Compatible with your OS and create an account online.