I like them all, so I definately have no desire to go (where this easily can) into a knock down, drag out, "mine is better than yours"... All three calibers have advantages and disadvantages when compared with the others.
40 S&W is the answer to a non existant question.
I used to say the exact same thing, now it is one of my favorite defensive calibers (when I'm in a carry state and not carrying a revolver it is my #1 caliber, while I usually use .45ACP for home defense).
While I can't really say why so many police agencies went with it, here are my reasons for my changeover:
-It has comparable power to the .45ACP. Depending upon what measure you use (muzzle energy, Taylor Index, the discredited "one shot stops," etc.) it comes out nearly equal to or even slightly above similar .45ACP power levels.
-It can be chambered in smaller framed weapons than the .45ACP and still hold more rounds.
-While the 9mm can hold more rounds, it isn't as powerful. I think it is enough (and in the smallest guns in these calibers I'd go with the lower recoiling 9mm), but the extra gain in the .40 is quite reassuring.
-Related to the last point, while you can get similar performance between all three with the right ammo choice (which negates any price benefit of the 9mm BTW since the really good 9mm ammo costs the same as the best ammo in the other 2), ammo selection is particularly important in 9mm. There are some great performers in 9mm defensive JHPs but there are some that are quite marginal as well. With .40S&W out of any common barrel size, and .45ACP in standard (4+") barrel sizes, even the most marginal defensive JHPs have pretty decent performance. In a short barrel .45ACP loses this advantage, but .40S&W keeps it, so in a short barrel I definately choose .40S&W over even .45ACP.
-While I do think the .40S&W recoil is less comfortable than either 9mm or .45ACP it is only marginally less comfortable. In any but the smallest guns it is chambered in, it is comfortable to shoot (in a service sized pistol it is quite comfortable). However, in a pocket, or near pocket, sized gun (like the Kahr PM series) I would prefer a 9mm.
For military and police use, there are two other advantages I see (though not concerns for me):
-Military: The military can only use FMJ. The 9mm is quite a marginal caliber without expanding bullets. The .40S&W isn't as big as the .45ACP, but it is big enough that its performance with FMJ isn't bad, and coupled with the next advantage I think it is even a good choice for the military (the Coast Guard apparently agrees since they went with the SIG 229 I believe, it may have been the 226, in .40S&W).
-Hard barrier penetration (walls, doors, car doors, windows): The higher velocity rounds (9mm and .40S&W) have a significant advantage in this area over the .45ACP. The 9mm has a disadvantage for military use due to no JHP the .45ACP has a disadvantage in hard barrier penetration, while the .40S&W is a nice compromise giving a larger diameter (better for FMJ only) and hard barrier penetration.
So, for all of us the .40 gives performance comparable to the .45ACP in smaller guns (better for small hands) and higher capacity. It gives capacity comparable to 9mm in the same sized guns with more power. It makes ammo selection a bit more simple than 9mm or even .45ACP if your gun has shorter than a 4" barrel (you can buy what is on sale if you are on a budget). For police and military use it gives 9mm-like barrier penetration with .45ACP-like power, and for the military it has a larger diameter than 9mm which is very important since they can't use JHPs. The cost is slightly less pleasant recoil, but it isn't bad or outside the capabilities of most shooters (especially in full-sized service pistols or the next size down, like the 229).