Introduction
I will answer your question from the perspective of submarine technology. While the answer to your question may or may not be different in regard to aircraft, missiles, nuclear weapons, tanks, and other forms of military technology, submarines were and are at the forefront of military technology development. Countless billions of dollars, roubles, pounds, and francs were poured into the development and production of quiet and capable submarines during the Cold War. These costs were not insignificant, even to the bloated defense budget of the Soviet Union, which consumed a significant fraction of the country's GDP. Some Soviet officers even claimed that the decision to develop and build a fleet of enormous submarines to counter the West, "undermined the economy of the USSR and contributed to the loss of the Cold War." The importance of submarine technology on both sides of the Iron Curtain is why I think it is worth answering your question from this perspective.
Nuclear Power
The most important advancement in submarine technology after WWII was nuclear power. Although the Soviets had gained valuable information on the U.S. atomic bomb project via espionage, the nuclear submarine projects of both countries were completely independent. The reactor plants - the Soviet VM-A and American S2W - shared few similarities, and the nuclear submarines themselves were quite different. The Soviet Project 627 submarine had two reactors and a torpedo-like bow, whereas the USS Nautilus had a single reactor and a more ship-like bow.
Both the U.S. and Soviet navies experimented with liquid metal-cooled reactors, which offered significantly more power than traditional pressurized water reactors. The S2G reactor on board the USS Seawolf used liquid sodium as a coolant, which was explosive on contact with water. Because of this risk, U.S. development on liquid metal reactors was halted (the Seawolf was refitted with a copy of the Nautilus' reactor). About a decade later, the Soviets built a single Project 645 submarine powered by two RM-1 reactors, which were cooled by an alloy of lead and bismuth. From this prototype, the Soviets built seven Project 705 submarines with the OK-550 and VM-40 lead-bismuth-cooled reactors. While ultimately these reactors proved to be more trouble than they were worth, the Soviet effort to developed liquid metal reactors was completely independent.
Strategic Submarines
Both the U.S. and Soviet navies began developing cruise missile submarines immediately after WWII. The German V-1 missile was the basis for the first submarine-launched missiles for both countries: the American Loon and Soviet 10Kh. The U.S. Navy quit its cruise missile program in favor of ballistic missiles (see below), but the Soviets kept developing it. In the early 1960s, they were able to produce encapsulated anti-ship missiles that could be launched while submerged, a feat which the U.S. Navy only accomplished around 1980 with the Harpoon missile.
The Soviets were the first to develop ballistic missiles that could be launched from submarines. While the U.S. Navy was pondering how to fit the large Jupiter missile into a submarine, the Soviet stuck their copy of the German V-2 missile into the sail of a diesel-electric submarine and had an operational ballistic missile submarine years before the U.S. However, these early missile submarines only had two or three missiles and had to surface to fire them.
Commissioned in 1960, the USS George Washington was able to launch 16 Polaris missiles while submerged, a significant advance over the earlier Soviet missile subs. When the Soviets came out with their equivalent in 1967, Project 667A, NATO gave it the code name Yankee because it looked similar to the George Washington and carried the same number of missiles. But Russian sources indicate that even these superficial similarities were not particularly influenced by the U.S. design. The Soviet submarine had liquid-fueled missiles (as opposed to the solid-fueled Polaris) and two reactors (compared to the single reactor on the U.S. submarine).
Submarine Quieting
The U.S. Navy placed an early emphasis on quieting its submarines, both to make it harder for Soviet submarines to detect them and to reduce interference with the submarine's own sonar. When the Nautilus passed by a U.S. Navy seafloor sonar array, the Navy was surprised at how loud her machinery was. The myriad of pumps, turbines, meshing gears, rotating shafts, and propellers put out a racket easily detectable by sonar. This prompted a rapid program to silence nuclear submarines.
In 1960, the USS Thresher introduced an innovation called "rafting" which supported noisy machinery like the turbines and reduction gears on a "raft" that was isolated from the hull by rubber dampers. Rafting and other innovations dramatically decreased the noise of the Thresher compared to Soviet submarines.
It was only in the mid 1970s that the Soviets began to introduce rafting on their submarines, allowing them to nearly match the noise levels of U.S. submarines. By the early 1980s, Russian submarines had reached parity with U.S. submarines and several years after the fall of the Soviet Union finally began producing submarines which exceeded the quieting of the U.S. submarines.
Why the sudden change? In the 1960s, the Soviets paid little attention to quieting, instead focusing on submarines that could go faster, dive deeper, and carry advanced weapons. Two things prompted quieting to rise in importance:
Information obtained from John Walker, a U.S. Navy officer, which allowed the Soviets to decypher U.S. Navy communications (Walker may have sold info on submarine performance too). This showed that U.S. submarines could easily trail Soviet submarines because of their high noise levels.
The Soviet had measured the noise levels of their submarines and found them to be higher than expected (just like the U.S. had a decade earlier).
These two sources of information, one internal and the other gained via espionage, forced the Soviets to build quieter submarines. It is important to note that it was not Walker alone who changed the Soviet's priorities.
In the 1970s and '80s, Sweden, Japan, France, Italy, and West Germany illegally exported advanced computer controlled milling machines to the Soviet Union (the Toshiba-Kongsberg scandal). These machines allowed the Soviets to produce quiet submarine propellers more quickly, although the Soviets had already designed and produced these propellers (albeit more slowly) with their existing milling machines. This scandal is frequently put forward as the reason why Soviet submarines got so quiet in the 1980s, but it likely had little impact overall. The Soviet had already spent an enormous amount of time and money developing methods for carefully machining gears and turbines so that they ran smoothly and quietly.
Conclusion
In short, the answer is that the Soviets developed submarine technology mostly completely independently from the West. However, the Soviets did not develop their submarines in a vacuum. Mostly through publicly-available information, they were well aware of the advancements in western submarines and sought to match or exceed their capabilities.
But it seems that relatively little information was gained through espionage. The only major exception was the Walker spy ring, although the importance to Soviet submarine technology is exaggerated in the West.
In many cases, the Soviets developed more advanced technology than the United States. I covered some of this in a previous answer on this subreddit. They built the deepest diving, fastest, and largest submarines. They built dozens of submarines from titanium. They developed non-acoustic sensors to track quiet U.S. submarines without the use of sonar. They built highly-automated submarines with crews of only 30. They developed escape chambers for most of their submarines to save the crew in the event of an accident. All of this done with absolutely no help from the West.
Sources
Norman Polmar and K.J. Moore, Cold War Submarines, (Dulles, VA: Potomac, 2005)
Norman Polmar and Edward Whitman, Hunters and Killers, vol. 2 (Annapolis, MD: Naval Institute Press, 2016)
V. P. Kuzin and V. I. Nikol'sky, Voyenno-Morskoy Flot SSSR, 1945-1991, (St. Petersburg: Historical Oceanic Society, 1996)