Willard and others touched on the reasons. I'll give you my perspective. At one time, LE qualified out to 50 yards with a double action revolver with a 10-12lb trigger pull. They qualified at least twice a year with a fair amount of rounds being fired for qualification. In many agencies, that standard has been watered down to 15 yards max, once a year with some sort of striker-fired pistol with a trigger pull that's about half of the revolvers from back in the day and less total rounds fired. However it's spun, the bottom line rational was to be able to qualify as many people as possible with less rounds fired. Many agencies sponsor a recruit through an academy. Firearms isn't the first thing they do, usually a lot of classroom stuff comes first. So by the time firearms rolls around the agency has a certain amount of $ invested in a recruit. If they wash out then that is $ down the drain. So the standards have been watered down to allow a higher % to qualify.
So we come to the 40 caliber. First designed in pistols that were either all metal or at least poly pistols designed around the 40 from the ground up. Pistols like the HK USP and IIRC the Sig P226 or P229. Someone can correct me if I'm wrong on the Sigs. Pistols like Glock were simply 9mm pistols that they made the muzzle hole bigger and changed the mags. No, I'm not kidding. That's why early Glocks had issues and another pin had to be added. Also Gen 3 and 4 Glocks in 40 have issues with a WML, but that's a different subject. Point is, shooting 40 out of an all metal gun, or a pistol like an HK USP with the recoil reduction system is quite different than shooting 40 out of a lighter poly pistol. For me, shooting 40 or 357sig out of my HK USPc is like shooting 9mm out of my Glock. There is a difference. But what has taken over the LE market by and large? Yep, poly striker-fired pistols. Now I don't say that is necessarily a bad thing overall, but the fact is that today's generation of shooter (LEO and civilian) doesn't possess the same skill set as those that grew up on revolvers/all metal pistols. As such, the FBI went back to 9mm after having abandoning it back in the 80's because it has less recoil that 40. So again, more people can qualify with it.
Now to be clear, and all caliber wars aside, the 9mm has advanced since the 80's. Gold Dot, HST and other rounds have put the 9mm on a level playing field with the other service calibers. In other words, service calibers are about the same in terminal ballistics. One is not head-and-shoulders above the other these days. And 9mm is cheaper for an agency to buy all things being equal.
And when the FBI went 9mm a lot of agencies and people in general jumped on the bandwagon as if 40 was suddenly bouncing off bad guys. No, it was a fiscal decision as well as trying to cater to the lowest common denominator of recruit. So rather than take the time to train someone up to a higher level, we lowered the standards so more people could pass while saving a few bucks along the way. The merits of this line of reasoning can be debated.
However, the silver lining was that for 'those in the know' we could now pick up 40's at bargain basement prices in many cases. And a pistol that shoots 40 makes more sense because it can also be 9mm and/or 357sig, usually with just a barrel change (and mag in the case of 9mm although you can shoot 9mm out of a Glock 40 mag). A 9mm pistol can't always go up but a 40 can usually go down or sideways so to speak.
Anyway, my two cents after three decades in LE and firearms training for the agency (well, 24 of those years).