Britain placed large orders for the Swiss 20mm Oerlikon in 1939 after negotiations to have Oerlikon improve the original 1934 weapon. Very few (c100) were delivered by the unexpected fall of France in June 1940. Britain also obtained a licence to produce the 20mm Oerlikon in 1939. But it was late 1941 before various difficulties were overcome and British manufactured Oerlikons began to appear in significant numbers.
The USN had also rejected the 1934 Oerlikon. It decided in late 1940 to produce the modified version. This decision was very much influenced by the RN war experience to that point. The first came off the production line in June 1941 and by the end of the year production totalled 379.
As for the 40mm Bofors, Britain placed its first orders in 1937. It also acquired a licence to manufacture them. But modifications had to be made for mass production and initial production of the air-cooled type went to the Army. The RN received a handful in late 1941 (PoW received one). The water-cooled version was fitted to the stabilised Hazemeyer mounting which entered RN service in late 1942 in destroyers and sloops.
US interest in the Bofors existed pre-war but is was early 1940 before a sample was obtained and June 1941 before a licence was obtained. Many changes were then required before it could enter production. The first water cooled twin Mk.2 mount was produced in Jan 1942 and the first quad in April. The first fitting of a twin on a destroyer was in July 1942.
Someone noted above that RN ships sacrificed a set of torpedo tubes to gain more AA. No one mentioned the USN position regarding its pre-war destroyers, only the big Fletchers.
Setting aside the old four stackers, pre-war USN destroyers were designed to fairly tight limits to get those 5x5"/38 DP guns, big directors and many torpedoes. That only allowed them to carry the 4x0.5" weapons as light AA (6 in the initial Bensons). Only the larger 1,850 ton "Leaders" of the Porter and Somers classes, which only had single purpose main armament, got the quad 1.1". Using the early war RN experience, by early 1941 they realised that to get a more effective light AA armament there would have to be sacrifices. So the weight reductions began. First to go was No.3 5"/38. Ships with 4 sets of TT saw them reduced to 3. Ships with 2 sets of TT saw them reduced to 1 in some cases. This allowed the fitting of Oerlikons and then twin Bofors. But it didn't happen overnight. Come the kamikaze crisis in late 1944 / early 1945 more light AA was required and more sacrifices had to be made. That included removal of all the TT in some classes, to gain more twin Bofors and a reduced number of twin 20mm mounts.
By way of example USS Eberle DD430
As built in 1940
1943 - gone are the searchlight platform and No.3 5"/38. Added 2 twin Bofors and 4 single 20mm. Plus radars of course
1945 - gone are the TT. AA armament is now 2 quad & 2 twin Bofors plus 2 twin 20mm. Lighter Mk.28 radar on the director. Even then she was considered weight critical.