The old four-pipers originally had one or two 3in/23 AA guns, along with a main armament of four 5in/50. Between the wars they got two .50 cal machine guns. Beginning in late 1940 some ships received modifications for ASW work; in addition to ASW improvements the 4-inch and 3in/23 were replaced by six 3in/50, and the .50 cal battery doubled to four. Eventually the remaining four-pipers had five or six 20mm guns. A number were converted to destroyer-minesweepers and destroyer transports, but I won't get into that.
The U.S. destroyers built in the 1930s had the new 5in/38 dual-purpose gun (5in/38 single-purpose in the big destroyer leaders). Their standard light AA armament was four .50 cal. By 1941 the air threat was so serious that the King Board recommended that all modern destroyers lose a 5-inch mount in return for a 1.1 quad (they could not simply add a quad without compensation, because topweight was already a problem with some ships). In practice AA modifications varied considerably.
The Farragut class were the first of the interwar destroyers. They originally had five 5in/38 and four .50 cal. Early in the war no. 3 gun and the .50 cals were removed, and eight 20mm fitted. Later some 40s replaced the 20s. The final battery was two twin 40mm and five 20mm.
The Mahan class had five 5in/38 and four .50 cal as built. Early in the war mount 53 was removed. Initially these ships got six to eight 20mm. At some point they received 40s, and ended with a standard battery of two twin 40s and five 20mm. In January 1945 a plan was devised for further modification as part of the emergency kamikaze-defense program. They were to lose two of their three torpedo-tube mounts in favor four more 40mm, but only Lamson was actually modified.
The Porter and Somers-class destroyers were large 1850-ton ships, unofficially known as "destroyer leaders." They had eight 5in/38 single-purpose guns. They were the only destroyers fitted with 1.1s--two quads--as built, and originally had two .50 cal as well. By late 1941 at least a few ships had a third quad 1.1. It was clear by this time that the single-purpose main battery was outmoded, and there were plans for complete replacement with the standard 5in/38 DP. Some ships were so modified during the war. All or nearly all ships of these two classes lost their no. 3 5-inch mount in favor of 40s. Standard armament late in the war was either five 5in/38 DP or six 5in/38 SP, eight to ten 40mm, and six 20mm. In 1945 some received an emergency modification including the removal of all torpedo tubes, with light AA increased to 14 to 16-40mm and 4-20mm.
The Gridley, Bagley, and Benham classes all had four 5in/38 and four .50 cal as built, along with four quad torpedo tubes (in contrast to the two or three quads in previous classes). The Gridleys, with insufficient weight margin, were the only modern U.S. destroyers that never carried 40mm; their armament became eight 20mm. The Bagleys eventually were armed with one twin Bofors and six 20s. The Benhams were more extensively modified for Atlantic antisubmarine work in 1941. Most of these ships lost their two after torpedo tube banks for more depth-charges and launchers, and got three more .50 cal. Eventually they mounted three twin 40s and four 20mm guns. In 1945 three of these ships lost all their remaining torpedo tubes for increased light AA, ending with four twin 40s and four twin 20s.
The Sims class were originally armed with five 5in/38, along with the new Mk 37 director, and four .50 cal. They were modified for Atlantic service in 1941: no. 3 gun was removed, depth-charge armament increased, and four more .50s added. Eventually they had two twin 40mm and four 20s. In 1945 three ships lost all their torpedo tubes to get two more twin 40s, an indication of the lengths to which the USN felt compelled to go to counter the kamikaze menace.
The Benson-Gleaves class began entering service in 1940-1941. Originally they had five 5-inch, six .50 cal, and ten torpedo tubes. There were many subsequent variations in this class, which are too complicated to get into: some had five guns and five tubes, some four guns and ten tubes, etc. A number of ships added four to six .50 cal in 1941, along with ASW improvements. At some point the standard AA battery for five-gun ships was six 20mm, while four-gun ships at one point had one quad 1.1 and five 20mm. At the end of the war most Bensons had two twin 40s, and 4 to 7-20mm. In 1945 twenty-eight ships received an emergency AA modification: all torpedo tubes were removed, and 40mm armament was increased to twelve barrels.
The original specified armament of the famous Fletchers was five 5in/38, one quad 1.1, and four .50 cal. Only a few were completed to this standard. Most early Fletchers had one twin 40mm and four 20s. Soon 8-20mm was standard. By early 1943 standard armament was set at three twin 40s and ten or eleven 20mm. At some point in 1943-1944 this became ten 40mm and seven 20s. In 1945 some ships lost their forward torpedo tubes and ended with 14-40mm (two quad, three twin) and six twin 20s, along with new Mk 63 directors for the 40mm quads. By November 1945 only 53 Fletchers had been so modified.
The big new Sumner and Gearing-class destroyers had twelve 40mm (two quad, two twin) and eleven 20mm. In 1945 many--apparently most if not all--received an emergency AA modification. The after torpedo tube was removed and replaced by a quad 40, for a total of sixteen 40s; the battery of single 20s was replaced by ten twins.
Early destroyer escorts, or at least many of them, had a quad 1.1 on the after superstructure,and a few 20s (apparently three to five?). Eventually the standard battery in the early short-hull (Evarts class) DEs was one twin 40mm and five 20mm, increased to nine 20s. The long-hull, 3in-gunned types (Buckley, Cannon, Edsall classes) had a quad 1.1 or twin 40 aft, and four to ten 20mm; most probably had ten in the end. A main battery of three 3-inch was quite light for ships of this size, and in the Rudderow and John C. Butler classes this was increased to two 5in/38. Standard light AA on these ships was apparently two twin 40s and 10-20mm. Late in the war some lost their torpedo tubes for more antiaircraft guns: some had ten 40s and ten 20s, and some four single Army-type 40mm guns.