Originally things were numbered after the year they were adopted. That's how you get the M1917 Rifle. The problem with that is when you start buying stuff in the same year. That's how you get two different M1917 pistols, one by S&W and one by Colt. This resulted in obvious confusion, so the numbering system was streamlined.
The newer system used a "T" number for "Technical" item. Something being evaluated technically. We get the T20 series as mentioned, but also things like the T26 Pershing tank (which became the M26) and the T26 version of the M1 Rifle. Incidentally this is where the "tanker Garand" myth was born. The T26 designation for the tank and rifle got confused. People thought they went together, so the short Garand was thought to be for tankers, when in reality they were ordered for the Pacific theater for a shorter rifle in jungle use.
Anyway, we wind up with a whole series of M1's. M1 rifle, carbine, helmet (steel pot), ammo can(.30cal size), etc.
Time passes and various items are adopted at different times. So we wind up with the M4 cabine (as noted above) because it's the 4th one. As far as rifles went, there were a series of rifles adopted for various used, like .22 trainers, target, survival, etc. Some of these didn't get off the ground, but some did (like the M6). When the M-14 (T44E4) was adopted, "14" was the next number available.
At this time the number system was streamlined even more. To further reduce confusion, the "XM" numbering was used. This simply assigned a model number to all projects, with an "X" prefix for "experimental". Upon adoption, the "X" is dropped. That's where we get XM-16E1. This saved money as well, because existing stocks of manuals, etc could still be used without confusing the troops too much. Experimental variations of an adopted model get an E suffix. So the XM-16E1 is the first experimental variation of an experimental model. Upon adoption the E is changed to A for adopted variation. The M16A2 was the M16A1E1 before adoption. The first experimental variation of an adopted variation of a standard model. The experimental variation phase can be bypassed if it's an obvious thing that doesn't need testing.
So you get the M9 bayonet simply because it's the ninth bayonet to be adopted.
The M9 pistol was a competition held for the new pistol that was politically named M9 to focus on the fact that we were buying a 9mm no matter what. All competitors were XM-9s, and the adopted model dropped the "X" and became the M-9. The Army skipped the M-10 because we already were using S&W M-10 revolvers, so they didn't want to confuse folks. The next handgun was the M11 (Sig P228).
So it looks like there's whole missing blocks, but in reality there are items that account for each number missing.
You get an M1 tank because the large number of vehicles tested resulted in numbers over "1000" (the HUMMVEEs), and once the get that high, it's hard to say, and not as easy to use. They simply restarted the number sequence. M1, M2, M3, etc.
The Navy uses a similar number system with "MK" and "Mod" in place of "M" and "A". The Navy developed the Mk19 for patrol boats, and the ground folks use the same designation. So we get the Mk19 40mm.
AS an aside the M1941 Johnson rifle was not select fire. Only semi-automatic. The Johnson LMG (M1941 and M1944) was select firing from a closed bolt on semi and open on full.
Ross