Im more concerned about why hydrogen and oxygen, both flammable and will burn, somehow combine into water that puts out fires.
Figure that out.
Water doesn't burn for the same reason that ashes don't burn, it has already combusted. Water puts out fire by cooling it and smothering it, much akin to using a fire blanket to smother the flames. Fire needs Oxygen, Fuel and Heat, remove any one and it goes away.