This question has been vexing me forever since playing World War Two shooters, and in effect WWI shooters as well.
On the matter of individual weapon assignment in the US Army, there's no beating this post from u/the_howling_cow, with some of their previous answers on the same matter also linked, though this post by a now-deleted user is useful for further insight.
For the Germans, the first link posted also contains an answer from u/thom430 as to who'd get MP40s. They also have this post on the Soviet side of things.
u/Bacarruda notes in this post the issuance of Sten to British officers, though there doesn't seem to be anything so far posted on the sub about enlisted British troops getting any.
My search efforts have not turned up anything from the sub regarding the Japanese issuance of their Type 100, unfortunately.
In the U.S. Army, submachine guns were either issued to specific men in a unit or were part of a pool company commanders could draw on as needed.
In February 26, 1944, Table of Organization and Equipment No. 7-17 for the Infantry Rifle Company authorized six submachine guns for each Company HQ. These could be parceled out as the company commander saw fit.
This lead to a variety of different arrangements. Some companies issued Thompsons for certain situations (e.g. issuing them to combat patrols or a small group going on a raid). Others issued them to each squad (with six Thompsons available, every other squad in the company could have one). If this was done, the squad leader generally carried the Thompson--however there are many cases of squad leaders keeping their rifles and passing the Thompson along to another soldier.
In other cases, soldiers would beg, borrow, steal, or scrounge their preferred weapons. Very few units in the ETO strictly followed their official TO&E throughout the war. Some platoon leaders and company commanders carried Thompsons. Intelligence men in some battalion S-2 sections carried rifles and Thompsons when they were only supposed to carry M1 carbines.
The G.I. History Handbook covers some other unusual weapons arrangements that illustrate just how far soldiers could deviate from the official TO&E:
Airborne infantry units used a similar arrangement, as explained here:
From July 1941 to February 1944, submachine guns were in the T/O of the rifle companies authorized for the company first sergeant, platoon sergeants, and assistant squad leaders. The mortar squad leader was also authorized a submachine gun from February 1942 to February 1944. In the early days of the airborne, these likely were intended to be M1928A1s until the adoption of the M1 in early 1942. However, in February 1944, the platoon sergeants’ and assistant squad leaders’ Tommy guns were removed from the T/O in lieu of M1 rifles, while the company first sergeant was rearmed with an M1A1 carbine. Thereafter, at least on paper, 6 submachine guns were allocated to the company to be distributed at the company commander’s discretion depending on the situation. In early 1944 these may have taken form as the M1A1 Thompson, but by late 1944 and 1945 they were explicitly labelled as M3 “Grease Guns”.
However, the paratroopers in particular were notorious for going outside the bounds of the T/O to get equipment. It is probable that far more than 6 submachine guns were available to the average parachute rifle company, if not officially authorized. However, contrary to some misinformed beliefs, some movies and some video games, the M1 “Garand” was 100% the standard rifle and most common weapon for the infantryman in airborne divisions, not submachine guns or M1A1 carbines.
Table of Organization and Equipment No. 7-27 for the Armored Infantry Battalion Rifle Company from September 15, 1943 did something a bit different. Submachine guns were only issued to the drivers of halftracks.
The U.S. Marine Corps did things their own way, of course.
The short-lived Paramarines were perhaps the Marine Corps' most prolific users of submachine guns, issuing one Reising submachine gun for every three men in a squad (the rest carried Johnson rifles and machine guns). However, the Paramarines were disbanded after Guadacanal when it became clear that the Marine Corps had little use for an airborne force (Army airborne forces would prove useful in the Philippines later in the war, but that's another story).
Up until April 1943, the squad leader in each Marine squad was nominally supposed to have a Reising gun (after mid-1942, a Thompson gun), although shortages meant many squad leaders simply carried rifles.
After April 1943, the squad leaders would officially lose their submachine guns. However, this didn't mean SMGs disappeared.
Officially the Marines dumped the submachine gun from their official TO&Es from here on to simplify logistics with the new M1 Carbine coming online to replace both pistols and subguns, as well as in response to experience gained in 1942. They were still used, however, usually as carbine replacements by individual Marines are specialist weapons that were passed around a unit for certain situations such as clearing out a bunker.
Since u/DanKensington war curious, let's talk about the British Army, which tended to issue submachine guns to specific men in a unit.
In the rifle company organization used from April 1943 until the end of the war, four men carried Stens. The man in the platoon HQ who carried the 2-inch mortar carried a Sten as did all three section leaders (who were corporals). Platoon commanders often carried Stens or rifles, as it became pretty clear a pistol didn't provide meaningful firepower and made officers targets for snipers.
Parachute and glider units had more Stens, as they were more assault-oriented units with a greater need for close-range firepower. The platoon commander, the section leader, and one man per section was issued a Sten.