The simple explanation is that Hydrogen and Oxygen are common in the Universe, and like to get together, as H2O or as water precursors known as hydroxides. The materials the early Solar System formed out of included H and O, others contained H, O, H2O, and hydroxides. Earth is not even particularly “wet” compared to some other Solar System bodies (some moons, Uranus, Neptune, and perhaps worlds like Ceres?) We just happen to have much of our water on or near the surface.
Early Earth would not have had much in the way of free water, as the surface was molten, and most of the atmosphere is believed to have been blown off by the collision that created Earth’s Moon, but once a crust formed, the rain (reign?) of meteorites, asteroids, and to a lesser degree, comets, over the eons brought in lots of H2O and precursors. (”Type 1” meteorites are highest at ~20% water or precursors.*)
*If you want some rather “thick” reading (or at least I found it so) there is this:
https://en.wikipedia.org/wiki/Asteroidal_water
Hope this helps!
Must have been quite a lot, seeing as most incoming these days burns up on the way in. You would think any water would dry up pretty fast...Instead we have many quintillions of gallons. Hmmm.
Thanks for the link! Thick reading often has the most protein. :)