When was the Submarine Invented?

The submarine was first used in 1864 during the American Civil War but was not widely used until World War I. They were originally launched from boats.