How Does Water Put a Fire Out?
This is at first a puzzling question, because back in your mind is the thought that since hydrogen and oxygen are necessary to make a fire burn, it seems strange that water, which is composed of oxygen and hydrogen, will also put it out.
A burning fire throws off heat, but if too much of the heat is taken from the fire suddenly the temperature of the fire is sent down so far below the point at which the oxygen of the air will combine with it that the fire cannot burn. We speak commonly as though water thrown on a fire drowns it. That is practically what happens. Scientifically what happens is that the water thrown upon the fire absorbs so much of the heat to itself that the temperature of the fire is reduced below the point where oxygen will combine with the carbon in the burning material and the fire goes out.
To answer the unasked part of your question at the same time I will say that hydrogen and oxygen when combined as water will put the fire out rather than make it burn, more because when these gases take the form of water they are already once burned, and you know that anything, substance or gas, which has already been burned cannot be burned again. It required great heat to make oxygen and hydrogen combine and form water, and it also takes great heat to separate them again. So they are really burned once before they become water.