Long time ago, when ships were made of wood and used sail power, the Navy manned them. However, occasionally they'd get along side another ship and either boarded her or were boarded by her crew. Now sailing a boat is kind of an all-hands job. Below decks, the guys manning the cannon were kind of busy. Above decks, the guys were pretty tied up seeing that the ship didn't veer off course inspite of being pushed around by the wind and the other ship. But there was the repelling of boarders of the boarding party... and this was a combat job... not a sailing job. So the seagoing infantry was born.
Why "Marines"? Well, as has been pointed that's corrupted Latin for "sea body (group of people... colloquially combat troops)." If my minimal Latin education serves me, it would be "corpus marinus." The Navy considered other names, but those appropriate were taken... Army, Air Force, Coast Guard, National Guard, Los Angeles Police Department, Boy Scouts, Girl Scouts...;-D