During WWII the US had the Thompson and grease gun, the Brits had the Sten gun, the Germans had the MP40, the Russians the PPSh-41 and PPS-43, the Italians the Model 38, etc etc etc. These firearms were produced on a massive scale and given out to large numbers of troops and incorporated into the doctrine of war, especially by the Germans and Russians.
So why, after WWII, do submachineguns begin to disappear from military arsenals? I'm aware that they continue to exist, even today, in small units and specialty roles, but their widescale prevalence is completely gone from modern militaries. What caused their decline in use?
With the creation and development of the assault rifle, such at the STG-44, infantry now had a firearm that was able to reach out further than submachine guns, fire more rapidly than bolt- or semi-automatic rifles, and yet be more mobile than light or heavy machine guns. This was because of the round utilized by the assault rifle. Submachine guns fire pistol-caliber rounds at a high rate of fire. During WWII, experiments resulted in the creation of the assault rifle, which fired a rifle-caliber round but with a reduced gunpowder charge that fired the bullet from the rifle. This allowed assault rifles to be fired fully automatic, like a submachine gun, yet be mobile enough to be carried by a single man.
Submachine guns were effective in close-quarters combat, but outside of these ranges, approximately 50-75 yards, only rifles or machine guns were effective. Assault rifles filled this gap and as a result, many countries adopted the assault rifle as their primary firearms.
First, it took some time for the submachine gun to go out of style in a big way. The British retired the Sterling SMG in 1994. But, yes, you are correct that their use has declined somewhat.
First, let's look at why submachine guns were developed. During the First World War, both sides on the Western Front sought to build more flexible attacking formations that could break into trench systems in smaller and smaller units. As part of this, new equipment was required, especially smaller, lighter machine-guns that could be brought up in a speedy manner to clear and secure trenches (along with modern grenades, flamethrowers, and a raft of other kit.) For a good general review of this development, Bruce I. Gundmonsson's Stormtroop Tactics comes highly recommended.
If you wanted a good general review of some of the lighter machine-guns brought in, have a look at the French Chauchat, the Lewis Gun and a edition of the MG 08. These weapons were somewhat useful, but not as good for clearing confined spaces as a true SMG, and they were still very heavy with very heavy ammunition.
The solution was to build machine-guns that worked on pistol rounds - true SMGs. The Germans achieved this with the introduction of the MP18 in 1918, and more models under development quickly came on the market, notably, the Thompson SMG. Later, the Sten introduced in 1941 to save on production costs, the German MP40 and the PPSh 41.
These were distributed in various ways, but, basically, it gave a small grouping quickly-accessible automatic fire when balanced with other members carrying a light machine gun (LMG) and rifles.
After the war, there was a widespread recognition that the rifles did not need to carry massive rounds. NATO went from a 7.62X 51 mm to 5.56mm round, and the Soviets adopted a 7.62x39 around, eventually dropping even further to a 5.45mm round with the introduction of the AK74.
These "intermediate" rounds did not have the punching power of an old 8mm or .303 round, but did allow soldiers to carry a lot more of them and weapons to realistically use them in automatic mode. With weapons like the M16 and SA80 replacing the M14 and FN, you now had everyone carrying a weapons with an automatic function. Why bother carrying a weapon with a limited range?