Machines have built-in safety features. When you can no longer push a weight, you can slide out from under it. Free weights can pin you when your muscles tire. Also, weights can fall off the end of the bar and cause injury. Hope for the clumsy.
Machines remove balance as a factor.
With free weights, the novice must learn to balance the weight while exerting force. This can be difficult and dangerous when, for example, you lift a weight overhead or do squats. Machines ensure correct movements for a lift, which helps prevent cheating when fatigue sets in. Barbells, in contrast, can be swung for momentum rather than lifted slowly and steadily, which works the muscles better. Machines isolate the specific muscles that are exercising.