Submarines were mainly used in this war against merchant ships rather than against military ships. This was done both by the Germans and by the British, but it was much more important for the Germans.
In previous wars, surface ships had been used as "commerce raiders" to stop ships that were bound for enemy ports. In World War I, this role fell more and more to submarines. Submarines could do this job much more effectively than surface ships could. Therefore, submarines were used mainly to try to blockade enemy countries, preventing ships from getting through with vital cargos.