There's plenty of advice in the threads here, so do a good search and try to find out as much as you can. But I'll put some of my thoughts down.
First, the best gun is the one that you will use/carry, and gain an intimate knowledge of through practice, more practice, and even more practice. Discussing 9mm vs. 40S&W vs. 45ACP can begin something known as "caliber wars." Everyone will have an opinion, and while most will raise valid points, I refer to the golden rule above. If you're not comfortable shooting your chosen caliber, you won't practice, and if you won't practice, you won't - and shouldn't - use/carry.
Here's my take... 9mm is generally the lightest load with the least recoil, but still has a snappy character to it. 45ACP has a stronger recoil, but more of a push than a snap. 40S&W, IMHO (and many others') has the most felt recoil and snap. Different things can affect recoil, not the least of which is gun size. Therefore, the smallest guns in the biggest calibers will have the most recoil. More recoil generally means slower return to target and follow-up shots, not to mention comfort of shooting, and desire to practice (yeah, I know... harping on that point over and over). Guns with heavier slides or overall weight will dampen recoil, but obviously add weight. Bore height can also affect recoil, as the forces sit lower towards the grip (Glock). Smaller guns will also generally affect the number of rounds available, but standard and extended capacity magazines are often built-in options.
In terms of effectiveness of the different calibers, with modern ammunition they are pretty much on an even playing field. All modern defensive ammo will expand greatly when ballistic characteristics are maximized. Many feel that there really is no advantage to carrying one over the other in terms of penetration, expansion, and effectiveness. However, many others will argue that while a 9mm may expand, a 45ACP won't shrink. I
Ammo prices and availability are also a factor (practice, practice, practice), and these are in constant flux and change. However, generally 9mm is less than 40S&W, and this is less than 45ACP.
Some manufacturers also have conversion barrels available for 40S&W to convert to 9mm. This can add even more confusion, and many will argue that you shouldn't use a conversion for anything more than plinking or practice (makes a more expensive 40S&W cheaper to shoot).
So what does this mean to someone like me... I own handguns in 45ACP and 9mm. I didn't see the advantage of owning a 40S&W, and I shoot both 9mm and 45ACP comfortably. I appreciate and own Springfield Armory XD(M) compacts and XD-S models in both calibers. They fit me comfortably, shoot well for me, I like the combination of safety features, and generally just enjoy everything about them (remember, you have to upkeep them, too). The XD line has been torture tested, and I have every bit of confidence in any of them to perform if and when needed.
I have held and shot Glocks, M&Ps, Shields, Nanos,1911s, and who knows what else. I always come back to my SA's. They have excellent round capacity for their sizes, and I feel comfortable carrying any of them IWB.
As far as another great starter handgun that I feel is very underrated, but is a great performer and equal to the SA for feel in my hands, is the Ruger SR series. I owned an SR9c at one point... very comfortable, well made (American), more accurate than I am, easily maintained, and definitely cheaper in price than most. Truth be told, more comfortable to carry than my XD(M), but not to shoot (for me). Comes in 9mm and 40S&W (for now). Worth a look.
Find a range you can rent at and shoot everything you can to get a feel for what you like. That's invaluable in trying to find your first gun.
Whew... a lot to type on a phone, and maybe more than you wanted to know about some things. There is always more to know and consider. There is no end to what I learn every day about firearms. Hope it was at least somewhat helpful.