From an earlier answer of mine
/u/Vepr157 has two great photo essays: An album of American nuclear submarine propulsors (screws and pumpjets) in roughly chronological order and Everything You Ever Wanted to Know about American Second Generation SSNs (Permit, Sturgeon and Narwhal) that cover the evolution of US submarines.
In the US, the teardrop hull was first pioneered in the experimental diesel-electric boat USS Albacore. The Albacore was part of a larger trend within the USN submarine community to try and incorporate the lessons of WWII and make submarines much more effective underwater. The teardrop lessened hydrodynamic resistance and allowed submarines to travel at unparalleled high speeds underwater.
One of the cliches common in the historiography of submarines is to describe the typical WWI and WWII submarines as being not true submarines, but rather submersible ships. These subs were to spend most of their patrol chugging along on the surface of the water their diesel engines and submerge when they approached an enemy force under battery power. The batteries of the period had both limited duration and could only propel the boat at lower speeds than the diesels. This need to spend time on the surface was why these submarines resembled surface craft. The teardrop or other more hydrodynamic hull forms have fairly poor handling on the surface. Modern USN submariners often describe cruising on the surface as akin to driving a floating oil drum. Teardrop hulls are very susceptible to roll and yaw. This would be a problem for both surface observation as well as basic handling. The problem was that wartime experience in the Second World War showed that submarines were extremely vulnerable on the surface with the advent of radar and the growing ubiquity of aircraft. The Germans u-boat arm pioneered a number of innovations such as the Schnorkel which allowed for U-boats to use their diesels underwater and purpose-built designs like the Type XIII and Type XXI which were meant to spend a good deal of their time underwater. These German developments proved highly influential for the Allied submarine development postwar. Both the Soviet diesel-electric Whiskey-class and nuclear-powered November-class used the Type XXI-inspired hull form, albeit with some crucial differences.
In the US, the aptly-named Greater Underwater Propulsion Power Program/GUPPY retrofitted American WWII submarines with more streamlined sails and made them overall more suitable to cruising underwater for longer periods than when initially launched. They also had a better-integrated snorkel and boosted the battery power of the GUPPY boats.
The GUPPY program influenced the Nautilus design, but it was the greater success of the Albacore's teardrop hull that showed the way forward. Both the diesel-electric Barbel-class and the nuclear-powered Skipjack-class used the teardrop hull. The advent of Hyman Rickover meant that nuclear propulsion would be the way forwards for the USN, and this meant that the teardrop hull would remain the dominant hull form for US boats. Nuclear power meant that the ships did not need to cruise on the surface at all save at port.
Ironically, despite being an advocate of nuclear technology, Rickover's instincts towards other aspects of submarine design were actually quite conservative. American sail designs remained roughly the same shape since the Skipjack, even though advances in metallurgy and testing could have led to a quieter and more efficient sail. Rickover scuttled the CONFORM project which would have produced a sailless, streamlined sub optimized for high-speed in favor of his more conventional 688-class design. Contrary to Tom Clancy's fiction, it was the Soviet navy that proved more innovative and open to new design elements. Both in hull form and in materials used, the Soviet design bureaus tasked with producing submarine designs were more willing to take risks and push the envelope of what was possible. Experimental boats like the Papa-class proved the feasibility of greater streamlining and Soviet submarines tended to have more squatter sails to boost both underwater performance and to reduce noise. The cumulative result of these experiments in the 1960s and 70s was that the Soviets began fielding submarines that quickly closed the operational capabilities gap between American and Soviet submarines. In his book Cold War Submarines, Norman Polmar relates an amusing anecdote from one of the Soviet Malachite bureau designers:
We had competition in submarine design. You [in Rickover] had Stalinism!
There was also another factor aside from hydrodynamics that encouraged the teardrop hull form: sonar. One of the challenges for naval designers in the Cold War period was to find space for the sonar arrays as they became larger. This installation of a soar array on a Permit-class gives a good indication of its size- and this album has a bunch more pictures. The bow was the best spot for this sonar as it allowed for an unobstructed forward view and some degree of side view. As these spherical and cylinder arrays got bigger it made sense to house them in a streamlined bow housing; uneven water turbulence could degrade sonar performance and the drag from a dome could cut into speed. The teardrop or some variation of this hull form was a way to get around this problem. The fiberglass or other materials used to cover the sonar domes sometimes created a differential appearance on the boats' markings as these materials reacted differently to the antifouling paints.
The designers of submarines in the Second World War could be at times be conservative, but they were well aware of hydrodynamics. A teardrop hull or more efficient underwater form would have boosted underwater performance, but the world wars' boats lacked the technology to capitalize on this. Batteries were heavy and could only propel the submarine for a limited duration. A teardrop might have bought a knot or two of speed underwater, but at the significant cost of degrading the operational capabilities of the submarine on the surface. It wold have been a trade-off without much in the way of real advantages given the propulsive technologies of the era.
To add to what has already been said, the teardrop hull was not an invention of the mid-20th Century. Rather, the limitations of submarine propulsion caused the ship-like hull form to dominate in the first half of the 20th Century. This is rather long, so perhaps I will break it up into parts.
Part I: The Teardrop Hull before the Albacore
Many 19th Century submarines had teardrop hulls, or at least roughly body-of-revolutiion hulls (i.e. where the hull is symmetric around the long axis of submarine). Many of these early submarines were intended for harbor defense, or very short range underwater attacks. As a result they were optimized for underwater performance. Two notable examples are the Confederate H. L. Hunley and French Plongeur. While neither technically has a teardrop or even body-of-revolution hull, it's clear that they were streamlined to be as hydrodynamic as possible underwater. The contemporary Intellegent Whale, built in 1863, had a form very close to a perfect teardrop hull.
The teardrop hull really came into vogue with the designs of John Holland, the designer of the modern submarine. From the late 1870s until the early 1900s, Holland designed several successful submarines with teardrop hulls, specifically designed with a hydrodynamic hull for their role as short-range harbor defense boats. The Holland VI (commissioned as the USS Holland (SS-1)) and the HMS Holland 1 were the first modern submarines and went on to form the basis of all subsequent major submarine designs. Holland's company - Electric Boat - continued to build improved and successively larger designs of the original Holland for the U.S. and foreign navies.
During the 1910s, the role of submarines shifted from harbor defense to coastal operations and long-range ocean patrols. Thus the submarine would have to spend the majority of a patrol on the surface, and the hull was modified accordingly. A teardrop hull gives excellent underwater performance, but the superstructure is easily swamped by waves and the submarines would roll in heavy seas. Thus the small superstructure on the Holland was enlarged into a ship-like form, a bridge/conning tower was added, and bilge keels helped the submarine stay seaworthy on long ocean patrols. The L-class, designed at the outbreak of WWI, shows all these features, but the pressure hull is still teardrop-shaped and very similar to the original Holland. Up until around 1919, the U.S. Navy and Electric Boat were still building submarines with a quasi-teardrop shape, the S-class.
The Royal Navy built several R-class submarines during WWI, which were intended as anti-submarine submarines. This was different from the modern conception of an ASW submarine, in that they would hunt surfaced U-boats as the fire control technology did not exist to fire at submerged submarines with a high probability of a hit. The R-class also had one of the earliest submarine sonar arrays.
In the 1920s the U.S. Navy began their designs from a clean slate, and until the end of WWII built submarines with ship-like hulls. This design, likely inspired by the fast and long-range German "cruiser" U-boats, optimized the surfaced performance of these submarines so that the transit time to and from patrol areas was minimized and so the submarine could overtake fast convoys. Submarines of the interwar and WWII periods were primarily surface ships with the capability to submerged. In fact, both U.S. and German submarines frequently made attacks on the surface at night. The small submarines were hard to spot in the darkness and had much greater speed to maneuver and evade convoy escorts.
After WWII, the snorkel, the Type XXI U-boat, the Walther turbine, and the promise of nuclear power revitalized the interest in submerged submarine performance. The Type XXI was a compromise between a body-of-revolution hull and a traditional ship-like hull. This influenced all future submarine design, most notably the American Tang and Soviet Whisky and Zulu. The Walther (hydrogen peroxide) turbine, nuclear propulsion, other air-independent, and, to a lesser extent, the snorkel all could allow for a submarine to be built soley for submerged performance. So why did we have to wait 10 years before the reintroduction of the teardrop hull?
TL;DR
Early submarines had teardrop hulls because they were short-range coastal and harbor patrol craft. When longer-range operations became necessary during and after WWI, submarines adopted a ship-like form for maximum surfaced performance. The advancement of submarine propulsion and the snorkel in the mid-1940s led to the development of streamlined submarines, but not the teardrop hull.
Source:
U.S. Submarines through 1945 by Norman Friedman
This comes from the differing roles played by submarines before and after 1945. In the period before 1945, submarines were more 'submersible torpedo-boats' rather than true submarines. They spent the majority of their time on the surface, submerging only to attack. This was mainly due to the poor qualities of the electrical motors and batteries available, as well as the need to surface to charge them using diesel engines. As a result, subs were designed with hull forms that suited surface operations. However, in 1945, the German Navy introduced the Type XXI U-boat, a so-called 'Elektroboot'. This class of submarine packed in batteries and heavy electrical engines, as well as using a more streamlined hull design. This, combined with the use of the snorkel, which allowed the Type XXI to charge its batteries while submerged, meant that it was able to spend the vast majority of its time underwater. The immediate post-war diesel-electric subs were, essentially, copies of the Type XXI concept. With the advent of nuclear submarines, subs became able to avoid the surface almost entirely. As such, introducing hydrodynamic designs became a higher priority.
That said, there were a few subs that adopted hydrodynamic designs before the Type XXI. In 1918, the British designed the R-class of submarines. These were specifically designed as an ASW vessel, designed to lurk underwater off German ports and destroy U-boats transiting on the surface. As such, they were designed for high underwater speeds and long underwater endurance. Part of this involved the use of a highly hydrodynamic hull, which was spindle-shaped and circular in cross-section. In an interesting twist, the hydrodynamic research done on this hull was used to inform the design of new RN airships - which were, in the 1980s, re-used in the design of the Swiftsure class subs. The R-class were, however, not so successful, thanks to the poor quality of available batteries - their range was far too short for typical combat use. In the late 1930s, the Japanese built an experimental sub, the No.71, which was designed to test how submarines would work at high speeds, requiring the use of a hydrodynamic hull.