As an 'old guy' (79 in April) who started training fifty-eight years ago, I'd say it's better to train at a gym. It's better still, of course, if the gym is very close, preferably walking distance. When I first began weight training - and that's what it was, for the modern equipment didn't exist, it was just barbells and dumbells in those days, the gym was in the next street.
I have trained at home - in the garage - when no gym was available, but it's a chore. I also trained alone when stationed on a sub-Antarctic island. Once again, it took real motivation go out into a cold, store room or lab room and to drag barbells from one place to another.
For the past twelve years I've been driving to a gym 20 minutes by car away. But what a gym! Huge! And even though I work out alone, there are always others around to chat to; familiar faces, people to joke around with as one works out.
As a fellow who's been pacing the treadmill and riding the bike which goes nowhere - and still pumping iron - for a very long time, the gym the way to go. Stay at the gym and you'll stay fit all your life.