In retrospect, Germany's decision to attack merchant ships and carry out unrestricted submarine warfare seems incredibly stupid. They knew – or should have known – that killing citizens of a neutral country (specifically the United States) even unintentionally was a damn good way to get America in the war on the side of the Allies.
Well, it turns out that Germany was relying on submarines to throttle British commerce. When the war started, the Germans had their submarines play by what had been the accepted rules of warfare when it came to merchant ships.
A German U-boat under fire during World War I. (Youtube screenshot)
You approached them, you got them to stop, and you allowed the passengers and crew to abandon ship before you sank the ship. When it came to warfare, it was reasonably civilized, given that you were sending those people from a relatively safe merchant vessel and into open lifeboats and rafts, with only oars and the ocean current for travel and not that much in the way of supplies.
As you might imagine, the folks on those merchant ships didn't want to go through that kind of ordeal of they could avoid it. So, the British started by arming merchant ships. Soon the submarines were being fired on as they surfaced. The invention of the Q-ship made following the rules for submarines even more hazardous – and a good way for the sub to be sunk. When subs sank, the casualty rate amongst the crew often was 100 percent.
A U-boat' victim starts its plunge to the bottom of the ocean. (Youtube screenshot)
German sub commanders didn't want to have that sort of end-of-life experience. Nor did their crews, for that matter. So, the Germans decided to carry out unrestricted submarine warfare where they shot the merchant ships on sight. And thus began the chain of events that would bring the United States into World War I on the side of the Allies.