The moon was formed around four and a half billion years ago. During its formation process rubble of the Earth and other space junk impacted the surface creating lowlands. Starting around four billion years ago, peaking around three billion years ago, and finalizing a billion years ago the lowlands began to fill in with lava due to volcanic activity. The lava then cooled down leaving the dark iron-rich soil known as basalt to form the maria. The lava was the only force of erosion on the Moon.
The term maria was given to the basalt flats because early astronomers thought these were actual water seas. The seas were named after various emotions like Sea of Tranquility (Mare Tranquillitatis) though this naming convention was dropped and seas are named after things like animals, weather, an astronomer, and even Moscow.
Besides seas there are also lakes (lacus), bays (sinus) and marshes (paludes). These are merely smaller seas.
Approximately fifteen percent of the Moon's surface is mare. The vast majority of these are on the side of the Moon which faces Earth. The probable explanation for this is that most of the impacts the Moon suffered came from debris from the Earth.