In WWII there was a lot of momentum to obsolete design theory on all sides. Old designs were already in production, and the war wasn't going to last long, right? The 5-inch deck gun (firing shells with a 5" diameter slug) was cheap and the shells did not take up much room. Torpedoes were very expensive, and once you were out of them, you had to go all the way back to a US Navy base. If an enemy cargo ship was disabled by a torpedo, but not sunk...it would be cheaply finished off by the deck gun.
However, that gun plus the wood-slatted deck created a LOT of drag (the pressure-hull is a cylinder, the wood deck is flat). Speed was roughly twice as fast on the surface because the bottom half of the sub was smooth.
Typical patrol behavior would be to cruise on the surface 24/7 with two lookouts and an officer on the conning tower. They would run on the surface for days with the diesels running constantly to propel the sub, and to keep the main battery topped-off. If they saw a surveillance plane they would dive immediately to periscope depth for protection, and wait till he was gone (running on precious battery capacity alone)...
The Earth's surface is curved (of course), and through high-powered binoculars, you can see the enemies' radar mast spinning on the very top of a ship before you see any of the rest of the ship (I've seen this on exercises, so I believe the Earth is not flat). The US war activity in the Atlantic in WWII was mostly about getting supplies to England, and avoiding or attacking German subs with planes and destroyer-ships.
The majority of the US's WWII submarine activity was focused on disrupting Japan's supply ships to their scattered bases around the south-west Pacific, and specifically sinking their warships. Most cargo-ships and warships were faster than a submarine, even when the sub was on the surface. All subs of that era were real pigs as soon as they submerged because of the cluttered deck. They had to patrol a common shipping path, and hope a zig-zagging cargo ship would pass by, headed somewhat towards them. Convoys were often escorted by a destroyer, which is a fast and small anti-submarine ship (2300 tons, 350 ft long, 250 crew).
The Germans were the first to experiment with using a snorkel during the war (due to heavy losses from attacking aircraft). With a snorkel, the diesels could be run at periscope depth as soon as an enemy aircraft was spotted, and the US copied them immediately.
Near the end of the war, the Germans had developed the elektroboot class (too late to help). The US, UK, and Russia all copied it for their Korean-war era submarines. The elektroboots had a snorkel, and also their upper half was as smooth as the lower half (no deck gun). They would still run on the surface to be able to spot an enemy or a potential target as soon as possible. But when they submerged, their speed was as fast as it had been on the surface, allowing a better chance at escape (along with a larger battery than before). When running the diesels at snorkel-depth, the radar on a plane could not spot them.
https://en.wikipedia.org/wiki/Elektroboot
One of the most dangerous times for a WWII submarine was running on the surface at night. If a planes' radar picked you up, it could attack the sub before it had a chance to submerge, and the sub couldn't see it coming.
https://en.wikipedia.org/wiki/Leigh_Light
After the advent of nuclear power, the immediate primary benefit was the ability to constantly run underwater very quietly. Diesels are loud, and they need air, which chains the sub to the surface. The noise tells the enemy that you are there, and roughly where you are...