As the old saying goes;
Buying a gun no more makes you a warrior than buying a piano will make you a musician.
YOU MUST LEARN TO UISE THE TOOLS WELL!
A small handgun carries well, and can be with you all the time, but it’s harder to learn to shoot well then a larger gun.
A home defense gun need not be small. In fact, the best choice for such a weapon is most often a good 12 gauge shotgun.
But if you can ONLY have one gun for reasons of budget, I would recommend a 40 or 45 cal medium sized handgun of GOOD quality, and no matter what gun you buy, get 1000 round with it to become proficient with. This ammo is NOT to be “saved” but you should shoot it up in the first year, and learn to use the tool you have purchased. You can buy 1 small box of good hollow point ammo as your “carry ammo” but that 1st 1000 rounds should be fired so that you can learn how to use the new gun well. If you are a new shooter, get a trained coach to go with you shooting and learn from your mistakes (you’ll make some, and that’s why you want to have a trained man or woman with you to point them out, and show you how to correct them)
Dry Fire teaches you technique. Live fire validates your progress.