What to do in the gym?
A personal trainer can tell you what to do in the gym. But so can any of hundreds of websites, and dozens of good training programs you can find on the web.
Part of the real value in a personal trainer is that your trainer can answer two important questions - "What next?" and "What now?"
"What next? - All programs, good or bad, will eventually stop working for you. Either you will progress past the limits of the program, or past the limits of linear progression (adding weight to the bar each workout).
When your gains run out, or the program proves to just not be working for your specific goals, a good trainer can answer, "What do I do next?"
"What Now?" - Even more important, how do you adjust your workout when life intervenes? An injury, illness, fatigue, stress - many things can derail your workout. If your workout plan says "bench press" and you've injured your shoulder, now what? A good trainer can answer that, on the fly, during a workout.
This is the most important part of the personal trainer's job - having the knowledge and experience to change your workout in reaction to changing needs, changing goals, and changing circumstances.
How can I do this myself?
Ask yourself, what if? What if I get hurt? What if this stops working? What if I need to substitute out because of missing or broken equipment? What can I do to keep getting a training effect? Know yourself, and learn what you can about training so you can make your own decisions.
3 hours ago