I’ve always been curious about this question. I have yet to hear a theory that totally makes sense to me. It’s quite remarkable how MUCH water is on our planet. The only thing that we can say with certainty, water either formed here during the formation of the planet, or after. Either way, it came from ‘outer space’, because the ENTIRE planet came from ‘outer space’(it wasn’t always here). The Iron in your blood came from a Super Nova that happened at some time in the past, along with the raw materials that were used to create virtually everything in the room around you.
The book “Comet” by Carl Sagan and Ann Druyan says that comets were a significant source of water on early earth. There were many times the number of comets then than there are now. Also, volcanic eruptions also bring water to the surface. The escape velocity from earth is significantly higher than for mars which is why most of the volatiles water vapor, etc.) have escaped from Mars, but not from earth.