I don't know about the Beretta APX in particular but usually it's the other way around. If the pistol originally came in .40 you can get 9mm conversion barrels as the slide on the .40 is beefier than the 9mm. The 9mm conversion barrels have the same outside dimensions as the .40 barrels except they have a 9mm bore so they can work in the .40 slides. Whereas the 9mm has a slimmer slide and will not accept a .40 barrel. Obviously the inside dimensions of the slide are smaller on the 9mm to fit a 9mm barrel as well.
On some 9mm pistols you have to buy an entire .40 upper assembly that fits on a 9mm frame. In which case you're probably better off buying another gun.