Why do chemical reactions occur?
Chemical reactions occur so that the atoms of the elements involved will become stable.
An atom of an element becomes stable when it completes its valence shell, which is the outermost (highest energy) s and p sublevel. For most elements, that means 8 valence electrons, called an octet. For hydrogen it means 2 valence electrons, called a duet.
Atoms of elements either transfer electrons to form ionic bonds, or share electrons to form covalent bonds in order to become stable, having an octet, or duet in the case of hydrogen, of electrons in their valence shells.
The atoms of elements do not know that we need substances such as water and oxygen in order to survive. They combine to form these substances solely to become stable.