The Mustang Mk.I (NA-73 and NA-83) had three machine guns per wing, one .50 and two .30's. Its been a while since I looked into the details of those, but I swear they were mounted upright (would love to be corrected if I'm wrong on that) - I can't find any photos showing that earliest installation. When the Mustang Mk.Ia and P-51/F-6A (NA-91) came out, it had two 20mm cannons per wing, which had to be mounted at an angle to fit.
One account I've read theorizes that when the A-36 (NA-97) was being developed, the USAAF wasn't immediately settled on the gun layout they wanted, and because of that uncertainty NAA left the design features in place that would allow for either the .50 cals or the 20 mm cannons. Another theory I've read about the reason the guns remained canted on the A-36 was that the angled guns were thought to better accept the ammo feeding from the trays squeezed within the dive brake housings. I believe quite a number of the gun bay parts simply remained unchanged from the A-36 through P-51A and P-51B/C production. The D-model gun arrangement was already in development with NAA well before the P-51B/C gun jamming problems arose in the ETO in late 1943.
The first paragraph of this document from NASA mentions the wing geometry staying the same from the NA-73 through the P-51D/K:
https://crgis.ndc.nasa.gov/crgis/images ... ctions.pdfWith regard to the P-51D/K often cited as being slower than the P-51B/C (sometimes said to be as much as a 10-15 mph difference), North American noted that there was an aerodynamic deficiency with the D-model canopy design and cut-down spine, which induced drag at the back of the canopy (it's why it is one of the most modified features on racing D's). During NAA's development of the lightweight Mustangs, the XP-51F, G and J, they experimented with lengthening the canopy and blending it more into the fuselage to better smooth-out the airflow/improve the aerodynamics. They made the side area of the fuselage of those and the P-51H "thicker" as well, so as to gain back the side-area that was lost when going from the P-51B/C to the D-model.