In the very beginning of earth's history, this planet was a giant, red
hot, roiling, boiling sea of molten rock - a magma ocean. The heat had
been generated by the repeated high speed collisions of much smaller
bodies of space rocks that continually clumped together as they collided
to form this planet. As the collisions tapered off the earth began to
cool, forming a thin crust on its surface. As the cooling continued,
water vapor began to escape and condense in the earth's early
atmosphere. Clouds formed and storms raged, raining more and more water
down on the primitive earth, cooling the surface further until it was
flooded with water, forming the seas.
Hope I helped.