It’s difficult to determine how water gets into a vehicle’s gas tank, but once it’s there explanations are almost irrelevant. The most critical issue is how to remove the water from your vehicle’s gas tank so that your vehicle will run well again. You can purchase commercial dry-fuel additives for this, or use the main ingredient in most of those additives, dry isopropanol alcohol, yourself.
Add dry isopropanol alcohol (IPA) to your fuel tank at a ratio of about 1/2 ounce of IPA per gallon of water-contaminated fuel.
Drive your car as usual. If you had only slight amounts of water in the fuel tank, the IPA will have soaked it up without significantly affecting combustion, and will burn away with the fuel.