EverKing's NACA P-38 "what if?" has gone into great detail about some very plausible ways the Lockheed P-38 could have been improved earlier and more comprehensively to make it the premier piston engined fighter of WW2. But it could also have been improved in one other area too.
That one aspect that could have been greatly improved, not only for the P-38 but for many Allied aircraft was armament. There already existed a method to massively increase the rate of fire and hitting power of aircraft mounted HMGs that the West did not develop shortly before the War or after WW2 began. But the Russians did. Here is an example of the Soviet ShKAS 7.62 machine gun first produced in 1933. It is an example of the revolver machine gun or revolver cannon in the case of larger caliber weapons using that principle.
These guns could fire about 30 rounds a second with a muzzle velocity approaching 2700 feet per second. Later versions could fire 50 rounds a second. The use of a revolving multi-chambered breech was an effective and proven technology pre-War. The Germans also developed a revolver cannon during the war. The Mauser MG 213. The revolver cannon design is still currently being used in several aircraft mounted gun design.
A better weapon could have been developed for Allied aircraft in WW2. What I think would have been a big advantage over the adequate but improvable .50 Caliber Browning is a revolver machine gun using the same .50 ammunition. In particular the .50 API. It wouldn't be a direct copy of the Russian ShKAS as there are other design features that optimize the .50 caliber gun for fixed mounted fighter aircraft installation.
Instead of having the revolving breech and ammunition feed being driven by recoil as in the ShKAS instead each gun powered by a motor. Either electric or hydraulically driven. This ensure that all the energy released during each firing is used for propelling the bullet. Which means an increase in muzzle velocity. I think. Readers who have a much better understanding of ordnance and firearms then I do might see this differently.
Driving the breech and ammo feed by motor is the method used in modern revolver guns. This also maintains the high rate of fire as the ammunition feed is robustly driven. It also eliminates misfires or hot firing because when the breech stops revolving no unfired ammunition will be placed in line with barrel and the last live round that was rolled inline would be fired off.
Speculating from historical and existing revolver cannons guns my proposed .50 caliber revolver machine gun could produce a rate of fire of about 40 rounds a second/2400 rounds per minute.
With an increased muzzle velocity of maybe 3100 to 3200 feet per second.
This is a significant enough improvement to warrant the mass production and replacement of the Browning .50 M2AN with this weapon. For example let's use the P-38 (of course) to demonstrate the advantages.
Instead of carrying the weight and space of 4 HMGs and the 20mm cannon two of the .50 revolver cannon are installed. Mounted with the two barrels space only about a foot or so apart when fired these guns are sending 80 rounds a second in a narrow stream with a higher kinetic energy and with the more accurate aiming that the higher muzzle velocity permits. A big plus if facing a head on attack with cannon armed Luftwaffe fighters.
On the P-38 carrying only two guns instead of 5 frees up more space for a larger ammunition load per gun. It's hard to say if there would be any large changes in the weight. Of course the revolver machine guns with their motors are heavier than the Browning M2s but there is only two of them
and the 20mm is removed also as the improvement in firepower negates the advantage of keeping the 20mm. In fact if weight and space permits install a third revolver gun. I would guess ammunition storage might be the limiting factor here. With two guns I think about 37 seconds of firing is possible. That's about 3000 rounds. Not bad. The OTL P-38 carried 2000 rounds for the M2s. Here we have the space freed up by having two guns and no cannon.
The .50 caliber revolver machine gun could be wing mounted in any fighter plane that has room for 4 or 6 or 8 M2s in it's wing. You can replace 4 M2s with one revolver gun and reduce weight and free up room for the larger ammunition magazines. A P-47 would have two per wing. When firing that's 160 rounds per second. Quite a punch.
What would be a realistic point of departure that would spur American and/or British interest in pursuing this advancement?