The following is mostly Geology and Biology and is of little interest to a real chemist.
The main two reasons behind the sea being salty are Hypothermal vents and Rain.
For some unmentioned reasons, chemistry A level students are required to recite the following:
The model for earth is that plate tectonics “float” on liquid mantle, and that they move due to currents caused by the constant change of mantle density resultant of nuclear shizzle radiating in the core.
So right, at the bottom of the ocean, those “trenches” allow the water to seep in. As the water seeps in, it flows against the molten mineral rocks, becoming a solution of those minerals and the water.
When the solution rises back to the ocean water, they cool down from the lethal 400 C’ to become black smokers ejecting sulphur and other minerals into the ocean, making a brilliant environment for bacteria to feed, colonise and grow.
The reason bacteria feed on this crap is because there’s no light for plants to photosynthesise at the bottom of the ocean so they have very different respiratory systems which were passed onto other life forms via evolution et cetera et cetera.
Then, as things are in the sea, big stuff eat smaller stuff. So the crabs would eat the bacteria for example.