Earth was supposed to have been formed about 4.5 billion years back in the solar system of our milky way galaxy. Its surface was covered with water vapour, methane, carbon dioxide and ammonia released from molten mass.
Subsequently, the ozone layer was formed. fu it cooled, the water vapour fell as rain and filled all depressions to form oceans and other water bodies.