The verdict
Same squat, different demands. Both list quadriceps as a primary muscle with glutes helping, both are compound push lifts with knee extension and hip extension as the joint actions. The Smith machine takes balance out of the lift: the bar rides on rails, the hooks catch it at any height, and the safety stops sit below your depth. The barbell squat makes you balance the bar, brace your trunk and control the path yourself, and it is the anchor lift of most beginner barbell programs. Pick the Smith machine to train alone, to push leg sets hard with built-in safeties, or while you build confidence before the barbell squat. Pick the barbell when you want the free squat itself, or your program tracks a squat number.
Muscles, equipment, force and level from the PasteLift exercise library records for the smith machine squat and the barbell squat. Sets and reps from the ACSM position stand, cited below.