I am a LE Sergeant, am retired US Army, have been a competitive shooter for 35 years, have been a firearms instructor 30 years, and was the plant manager for Kimber of America (firearms manufacturer).
First, get training. Not just basic firearms training, but use of force training also. I’m positive you can find a trainer/school in your area that provides both.
Secondly, for a defensive firearm -
I usually recommend a .357 Magnum revolver as a personal defense firearm for new shooters.
1. Allows you to use relatively inexpensive low-recoil .38 Specials for training, plus you can use .38 Special +P loads for self defense until you develop the ability to comfortably use the 125 grain jacketed hollow-point .357 Magnums (which is still one of the best, if not the best, defensive loads available).
2. Revolvers have an “ease of use” factor plus are extremely reliable and are easier to maintain when compared to auto-loaders.
Using factory center fire ammunition I have never had a “failure to fire” using a quality revolver out of the tens of thousands of rounds I’ve fired in revolvers; I can’t say the same with my auto-loader handguns (I like and own several auto-loaders as well as several revolvers, and I have a high degree of trust in my auto-loaders – but I also spend a lot more time shooting and testing my guns with various rounds than most folks)
As an alternative, a shotgun is also a decent choice, but I take exception to a couple things posted so far.
At less than thirty feet (10 yards) a shotgun still needs to be aimed. My LE Remington 870 (18” barrel) produces about a nice five inch pattern. At fifteen feet (a more realistic home defense range) the nine pellets of 00 Buck cluster at about two inches. Yes, a handgun can group tighter, but both will require aiming at this range to insure a well placed hit. At forty to fifty feet, the shotgun spread gets to such that “pointing” (instead of “aiming”) the shotgun
starts to become viable.
Any twelve gauge load (even a twenty gauge) can over penetrate standard double dry wall construction at close range, just as single projectile ammunition. The problem is with “shot pattern density” or “concentration of the shot”. We took a LE twelve-gauge loaded with #6 bird shot and shot clear through a section of double dry wall construction at ten feet. The shot pattern density at this range was dense enough to act as a solid projectile. Heavier shot will act like multiple single heavy projectiles – 00 Buck pellets are .33 caliber each and will act like multiple .32 Magnums fired from a handgun in penetration.
Hope this is informative,

This is me at a recent shotgun training. I'm the handsome one on the right. Note the ten yard pattern.