I will cosign most of what Corpsey and others have said about free weights>>>machines and the greatness of body weight exercises (pullups, dips, pushups, etc and variations thereof). machines are, tbh, pretty worthless unless 1) you're a bodybuilder, or 2) have a very specific need, like an athlete who needs to isolate and strengthen a particular muscle or group, or someone rehabbing an injury. you don't need to do machines to build up to free weights either. just use lighter free weights at first. if you lift diligently (and eat right!!) your strength will increase quickly (then less quickly, then it'll plateau, but that's a different issue and by then you'll be strong anyway). can't stress enough how crucial good form is, both to avoid injury and to maximize your results. so especially if you don't have prior lifting experience, learn the proper form first.
as corpsey said, squat/deadlift/bench is the powerlifting trinity. I would also add the Olympic lifts, clean + jerk and snatch, which are more advanced movements - so requiring more attention to form - but also great fun and unbeatable if you want to build functional strength. those are the basic barbell lifts, all essential.
pullups, dips, etc - you just have to do them religiously to get better. I do know a couple of helpful strategies for pullups if anyone's interested, as I know people find them difficult, but really there's no shortcut tho again, if you're consistent you'll improve.
rowing is another fantastic full body-exercise, with the added benefit of being aerobic, and a good substitute for anyone whose knees making running a bad option (or anyone who just hates running). any gym worth it's salt should have a rowing machine or two. as with everything, make sure you learn good form for the best results.
there's other great things (kettlebells! for one) depending on what equipment on you have available but free weights, body weight exercises and something aerobic are a great foundation. and tbh diet is equally if not more important. that's a whole other topic but if you want to get fitter and you eat like crap you just make it much harder on yourself.