How does a car protect you from lightning?

Because the car is grounded, the lightning finds a path through the car to the ground, rather than through you.

You do not want to be touching the ground and car at the same time lightning strikes the car, then the lightning will go through you to the ground.