It is the why that matters where exercise and fitness is concerned.
The why will be the motivation, not the where. As the recent disruption to our lives has demonstrated, we are inherently flexible and most people can adapt to changing situations. This principle applies as much to our fitness lifestyle as it does to anything else. So, regardless of where exercise takes place, where it happens and what works for us as individuals is the important thing.
I train with clients both in and out of the gym. During the closure of the gyms, I trained mainly in parks, with some online support for my clients. Now, I train both in the gym and in parks, with support offered online where needed. It's all good.
If training in a gym does not work for you, train outdoors or at home. Training outdoors is, in my opinion, a wonderful option, as exercising in the open air has its own energy and sensations, whereas training in the gym offers benefits in terms of equipment and convenience.
Whatever the location, it is the motivation that matters. So, feed that motivation to be fit and healthy for the long term, and choose what works best for you in the short term to get and stay fit and healthy.