Origin of water takes place on earth due to:
Meteor rain
Origin of water on earth is due to the meteor rain that occurred on earth and lasted for millions of years and each meteor with it contains a mystical fluid with it which we called today as "Water". Meteors covered the entire surface of the earth with water. So, most of the water we see today is gifted to us by the rain of meteors billions of years ago.
The reaction between hydrogen and oxygen in the presence of heat to initiate the reaction also produces water but at the time of origin of water, these gases were not present.