Where the 500 comes from
Heat carried by water is mass flow times specific heat times temperature change. One gallon of water weighs about 8.33 pounds, there are 60 minutes in an hour, and water's specific heat is 1 Btu per pound per °F. Multiply 8.33 by 60 and you get about 500, hence Btu/h = 500 x gpm x temperature drop.
In SI units the same idea is Q (kW) = flow in kg/s x 4.19 x temperature drop in °C. The constant 500 is for plain water; glycol antifreeze mixes carry less heat and need a smaller factor.
Why cooler return water helps
Condensing boilers squeeze extra heat out of their exhaust when the return water is cool enough to condense water vapor in the flue gases. Larger temperature drops and lower supply temperatures help them reach that zone. Supply temperature in this model is fixed at 180 °F as a simplification.