US submarines in WW2 were, with very few exceptions, fleet boats that were designed to operate with the battle fleet. That led to some specific design features. They were fast compared to other submarines, with a top speed surfaced of 20-21 knots, the same as the battleships. They had very long range, up to 20,000 nautical miles. These requirements meant that the boats were large, which in turn meant they could carry a heavy armament. Early fleet boats had 8 torpedo tubes, 4 forward and 4 aft, while later boats had 10 tubes, with 6 forward. Most fleet boats were air-conditioned, which with their large size made them fairly comfortable for the time.
German U-boats were designed for hunting merchant ships in the Atlantic. They were much smaller than US boats, and didn't have nearly as much range. They were slower on the surface with a maximum speed usually about 14 knots, and were usually armed with 5-6 torpedo tubes. Living conditions on U-boats were primitive and cramped.
The smaller size of the German U-boats gave them some advantages, though. They could dive faster than US fleet boats, which is important when there is a hostile aircraft bearing down on you. And they could dive much deeper than fleet boats, which had a maximum operational depth of 300 to 400 feet. U-boats could do about twice that, which made surviving an attack more likely.
Both the US and German submarines were well adapted for the roles they played. Great range and endurance were needed in the Pacific because of the extreme distance to reach patrol areas. But US submarines never had to face an enemy with the anti-submarine capability like the US Navy or the Royal Navy. The Japanese Navy had very poor anti-submarine forces, since they had never placed much priority on the matter
Source: Mark Sieving (Quora)