Swim classes should be reframed as water survival classes IMHO.
When our youngest turned 3, they moved him up to a class where I no longer got in the pool with him, and he was not ready for that. I told them he wasn't ready and they didn't listen. Ultimately, he wasn't getting enough time in the water to get over his fear of getting his face wet, and the instructors were rushing him too much that he started hating going. So we took him out and I bought a 12' diameter, 20" deep pool for the back yard (oof, getting the ground leveled to set it up was quite an ordeal). He is still aprehensive when he first gets in, but usually after about 30 minutes he's asking me to put on goggles so he can stick his face in the water. He'll get there.
Our oldest is 5. His first swim classes were at a different place entirely, but we moved out of there and had to find a new place (the place I hate). So I think he got a better foundation of familiarity with the water to then be able to get something out of the classes at the later school. He swims like a fish now. He recently attended a pool party for a friend's birthday and swam non-stop for pretty much 2 hours.
The "large kiddie pool" or "small above ground pool" was a good balance of cost (I probably put $300 total into the pool, setting it up, and care equipment/chemicals) and capacity for what they need, which is really just "figuring out how their bodies work in water."
The school that I hate is called Goldfish. They're a national chain. Avoid them, if at all possible.
No matter the skill, we humans are still the land creatures. Let's stay safe!
We naturally try to swim with our heavy head out of the water, but with full lungs most people will easily float for almost an unlimited amount of time, only popping your head up for a breath. Somehow, the more nervous you are, the more you struggle to keep your head out of the water. Learning that I could float like this for hours if needed keeps me calm in the water, I recommend you all try it, and keep it in mind to fall back on if you ever start to panic in the water.