In essence, a submachine gun is a shoulder fired fully automatic weapon firing pistol ammunition. Some consider the AK-47 to be a submachine gun (for instance the East Germans called it such) but they're just messing around with terminology. There are, of course, several weapons which are most definitely submachine guns which fire M1 Carbine ammunition, and certain modern personal defence weapons "PDW's" which fire their own bespoke ammunition.
Back in the day when we were playing football in the trenches with Fritz with ball ammunition instead of inflated pigs' bladders, there were rifles, pistols, and machine guns. Pistols, predictably, fired pistol ammunition, and both rifles and machine guns fired full-blown rifle ammunition. The rifles of the day were, with very few exceptions, bolt action, long and clumsy; and the machine guns of the day were absolute anchors. Various attempts had been made to produce decent shoulder-stocked pistols and occasionally to make them fire full auto, but these were expensive and crap.
If we briefly skip over the Alps now to the land of fine handmade shoes, small badly constructed cars with very loud horns, surrendering, and completely missing the point of firearms design, we discover the Villa-Perosa (spelling?) in 1915. This was a twin barrelled magazine fed weapon firing pistol ammunition. It mounted on a plate slung from the chest of the operator, which rendered it absolutely useless as a weapon. I'm sure it looked very pretty in combination with the very stylish Italian uniform, however,.
A couple of years later in the land of jackboots, Prussian militarism, well-made cars, no sense of humour, and fundamentally understanding weapons design, we find the MP 18. This was the world's first truly practical submachine gun, and for the next 30 or 40 years, most submachine gun design in Europe is merely tinkering with this clever little thing. The receiver is essentially a tube section in which reciprocates a cylindrical block which contains a firing pin. Out the left-hand side sticks a 32 round Luger snail drum magazine (which was crap, but they had thousands of them in stock and in production or ready for the artillery Luger). When the weapon is cocked, the breech block is held to the rear by the trigger mechanism, and when the trigger is pulled this block can run forward, strip a round out of the magazine, chamber it, fire it, and then the chamber pressure inside the cartridge case then pushes the breech block back to the rear where it can rinse and repeat for as long as the fire a holds the trigger down.
A little later, over in the US, a chap called Thompson invented a light-support weapon firing the 45 ACP pistol cartridge from an open bolt. This missed the point somewhat, so a few years later he chopped it down and made it into the first American submachine gun. Compared to the rustic simplicity of the MP 18, the Thompson 1928 is a bit of a Rolls-Royce, made from large chunks of machined steel and incorporating a bolt retarding mechanism known as the Blish lock, and even a hammer pivoted on the breech block. Both of these features were absolutely redundant and were later deleted, although the Blish lock did slow down the rate of fire somewhat.
Back over in Europe now, tinkering with the MP 18 (and getting rid of that ghastly magazine) had given rise to a number of fundamentally similar weapons, which could be described as first-generation submachine guns. Some were further from the original than others, but the principle remains the same. The start of the Second World War brought a drive for simplicity, so designs were rationalised, leading to the STEN, Owen gun, etc. these rationalised designs, usually all metal or metal and plastic could be considered as a second generation of submachine guns.
After the war, a clever Czech chap invented the overhanging bolt, in which a portion of the bolt overhangs the barrel, thereby allowing the whole action to be shorter. The most famous submachine gun using the system is the Israeli Uzi. This same principle was also applied to several other designs, which could be described as a third generation of submachine guns.
The Germans, not wishing to be outdone by a Jew, put their finest talents at over-engineering and over-complicating in a room together, and they came out with the MP 5. This uses a totally unnecessary roller delayed blowback mechanism much more suited to full power rifle cartridges or intermediate power assault rifle cartridges, and fires from a closed bolt. Great for accuracy, bad for safety if you want a high rate of fire. Horrifically expensive, they tend to be used more by police and special forces them by regular armies, and as such they have achieved a Gucci status. H&K's latest submachine gun offering, the UMP, has done away with this folly.
The latest designs, such as the MP 7 recently procured for the RMP, and the FN P90, are more like scaled-down rifles with properly locking bolts or delayed blowback systems firing cartridges not dissimilar in performance to various unsuccessful handgun wildcat cartridges from a few years ago such as the .224 BOZ (which was a pistol cartridge necked down to accept a 5.56 mm rifle bullet). The aim of these cartridges is to get better performance against body armour up to 200 m without having to pack a proper rifle. These weapons are perhaps better described as Personal Defence Weapons rather than submachine guns.
See also Machine Pistol