I feel like the good old AR-15 doesn't get enough love when people talk about home defense. It's relatively compact, its lightweight rounds will actually penetrate less than many handgun bullets which are heavier, you get a 30-round magazine and the benefit of a red dot sight to help you put a bullet in the right place, virtually no recoil so follow-up shots are fast easy and accurate (also makes it a great option for women and/or people who don't practice as much as they should).
A rifle is awkward to maneuver around corners inside a house, so you change your strategy and play to its strengths... If somebody broke into my house, I'd be posting up at the end of a hallway or locking the door and hiding in my bedroom behind cover with rifle pointed at the door from across the room. A rifle is great for that - not so much for going room to room checking on things. When I hear a bump in the night that I'm 90% sure is nothing, I grab a handgun and go investigate. If I were to hear breaking glass, people moving around, etc, I'd grab the rifle, stay put and call 911. Just, lord have mercy on my hearing if I ever have to shoot a 5.56 indoors...
For a new gun owner, I feel like you can't go wrong buying an AR-15 and your choice of compact (ie able to be concealed, even if you don't plan to carry) handgun in 9mm or .40s&w caliber (glock, smith and wesson M+P, etc).