I started with 3 half-hour sessions a week, bumped it to 4, bumped it to 45 minutes, then to an hour as I gained strength and stamina. For the 1st year I gained muscle steadily (after losing 35 pounds with an illness, I was in bad shape). After that first year, my gains slowed way down; from what I've read that's pretty typical. After 18 months I bought some dumbbells and other equipment for my home gym and have slowly transitioned to doing more workouts at home. For 2024 I'm doing all workouts at home, every other day. If I regress I'll go back to the trainer's gym, but at my age, I'll be happy with just maintaining my strength.
IMO, trying to start a workout program on your own is not likely to be successful: there's just too much to figure out on your own without a professional explaining things. Another key aspect is getting a feel for when your body is becoming overloaded and when you can continue to push it. A good trainer will be able to ensure you don't overdue it and get injured, and with time, you will develop a knack for doing this yourself.
I'd encourage everyone who can afford it to hire a trainer. Best investment I ever made in myself!