Size, Speed, and capacity, the .40 S&W offers the best of all three.
It's bigger than a 9mm, faster than a .45, and comes in MANY platforms that have reasonable capacity, not much less than 9mm and much more than .45.
I own 4 different brands of handgun .40 S&W that I can have a 9mm barrel and mags for, and .357 Sig barrels for.
In these handguns I have three potential calibers in one weapon.
What's not to love?
I'm unaware of any study showing the the .40 S&W is any worse and dispatching bad guys than 9mm or .45.
All we're really talking about here is preference ans prejudice.
I don't dislike ANY caliber that may save my life some day.