I'm surprised no one has mentioned electrons and orbitals yet.
Oxygen is a reactive species because it required an additional two electrons to fill it's outer shell and become stable.
Hydrogen is also a reactive species because it requires the loss of an outer electron to become stable.
When two hydrogens react with one oxygen they share their outer electrons with the oxygen to complete it's outer shell. This produces a stable molecule which has no need to proceed in further reactions i.e. it is not reactive or flamable. It is energetically stable
http://homepages.ius.edu/GKIRCHNE/Water6.jpg