You don't need a gym membership to get in shape
Gym memberships where I live are extraordinarily high-priced. This is because there are so many people here and the space required to have a gym comes at a premium, especially in the downtown area where I live. I really should just not live here though and find a way to work remotely instead of even contemplating commuting like the hundreds of thousands of poor saps I can see on the highway each day that are all stuck in traffic for hours.
That's a story for another day though.
I was looking over a list of the biggest lies the fitness industry tells you and it was a reasonably interesting read but still had its own biases and of course products they were pushing which is simply what the world is today no matter where you look.
But because this particular author(s) were not affiliated with or sponsored by any particular gym or chain of gyms, their end result was that you don't need a gym membership in order to get into or stay in shape.

src
what a dream come true it would be to actually walk into a gym and have it be this deserted... not gonna happen where I live!
Their conclusion about not needing a gym to get into shape is obviously true but it is also true that you can lose weight by just drinking beer or only eating whey protein, and you can also prep for a marathon while only eating ice cream as subsidence. These "possibilities" are not necessarily good ideas though.
The gym, even if you only go there for a short while, is going to introduce you to things you may not have even thought of despite the myriad of influencers and youtube videos that all of us have at our disposal. Especially if you can get your hands on a reasonably priced personal-trainer (some of the rates these people charge are just insane) they are going to be able to teach you how to do things properly and if you were to just wing it, there is a better than average chance that you are NOT going to be doing it properly. You'll probably be doing more good for yourself than if you did nothing at all, but you will not have a good session nor will you really understand the importance of shifting of focus as far as body is concerned.
A trainer, even a poorly trained trainer who barely got certified, is really going to press you to make a journal and log things such as what exercises you do and how much of them you do and how much weight you did. This is really ground-level stuff here but so many people skip this absolutely crucial step because they don't really know where to begin.
This is where a gym comes in handy. This doesn't mean that you will always need to have a gym membership, I know at times I kind of wonder why I keep mine because lately, I have only had about 2-3 sessions a week and the amount of time I spend in there is kind of dictated by how many other people are there.
One thing I used to do in the past was an interesting spin class notion that my gym had where it was a spin class followed by a talk and a social while people got a free water, gatorade, or protein shake.

src
This was actually something I found very helpful because I think a lot of people find it difficult to meet people that are into fitness and even more so, finding people that are at your level of fitness. When I was a gym-bro that was on the weights every day for a couple hours and jacked as shit, I made friends with like-minded people, but this took a really long time.
For the most part I think that most people are afraid to speak to other people at the gym and well, you probably should be. In this day and age where everyone is wandering with their sound-cancelling headphones on and looking at socials between sets, it can sort of seem like it is against the rules to talk to anyone. I wish it wasn't that way, but it is that way.
This social group with the spin class, kind of forced you to talk to other members of the gym and I'm not going to say that all of his was awesome, some of it was uncomfortable such as the dude that was already in really good shape and didn't put a shirt on while we were all sat around just talking (he's a douche for sure) but for the most part this introduced me to people that get together for things that aren't just drinking and eating. It ended up being very helpful to me and one of the people that I met that day is one of my best friends now, even though it is years later.
If you are considering joining a gym and are a beginner or you are out of practice, I would have a look to see if they have courses like this because I found it to be of very great help. Of course the gym tries to sell you things during these classes and others that I have been to almost seem like those timeshare gatherings where the entire point of you being there is because you are a captive audience and all if it is a sales pitch. Fortunately, the courses I went to were not like that although they did try to sell you personal training.
Personal training is too expensive and most people think that they can get the same results without a trainer. Well, you probably cant. I mean you can get there, but the level of dedication required on your part alone is something that not many people have, especially if they are new to the game. You need exterior motivation when you are first starting out and you also need a teacher. I think the important thing to do is to be honest with your trainer that you are only going to employ them long enough for them to develop a program and get you started and then tell them how long they have to make this happen.
If you leave it up to them they are going to stretch this out for as long as they possibly can in order to get more money out of you. I don't like that the industry is this way, but it is this way. There are probably about 10x as many personal trainers as the industry actually needs and this is just how it works.
It you are honest with them and they try to BS you into signing up for more just be stern and say "this is how it has to be, if you can't / don't want to do it, I will choose another trainer" and guess what, they will do it.
But getting back to the original point of how a gym isn't necessary for getting into shape, this is a very true statement, but there is something about going to the gym and being around like-minded people that is very motivating. Also, you can ask questions of others who are there and most people are actually pretty receptive of this. Strangely, I have found that the more jacked a person is, the more likely they are to be friendly to you about the process.
A gym is only as useful as you make it and most gyms have intro programs that are nicely priced to have a trainer show you how to use the equipment properly in the first couple of days or weeks. Then it is kind of up to you whether you want to use them anymore or if you can afford to.
For me, I am advanced enough now that I probably don't NEED a gym at all. I am familiar enough to body-weight exercises that I can do most of what I need with that but I still prefer the gym.
Is it worth the $200 a month I spend for it? Absolutely not! and this is why I am currently in the process of discovering a new gym program or perhaps even another gym.