The Bofors 40mm gun was first developed in the early 1930s, in response to a 1928 request by the Swedish Navy for a ship-mounted anti-aircraft weapon. The firm developed automatic guns in caliber ranging from 20mm to 57mm, but the 40mm because a tremendous commercial success. They were used by many nations on both sides of World War II in both naval and ground applications, and the gun is still in use to this day.
In the US, production was done by the Chrysler corporation during the war. The Bofors design was a very complex one, and originally used a lot of hand fitting in assembly. Chrysler was unable to simplify the design, but was able to dramatically reduce manufacturing time by changing to more production-friendly methods (like the use of cast and powder-metal parts instead of all milled components) and the use of fully interchangeable parts.
The ground variant was typically a single gun mount and air-cooled, while Naval guns used a water cooled jacket around the base of the barrel and were generally mounted in pairs and quartets. Modern versions use powered magazines capable of firing up to 330 rounds per minute.
Allpar.com has an interesting article on the Chrysler manufacturing of the 40mm Bofors.