[Physics] How does a gravity car work (and where does the energy come from)

newtonian-gravitynewtonian-mechanicspotential energy

So I am doing an experiment with gravity car, basically dropping a hanging mass and spins the axle using a pulley system. see the graph
And then I thought although the work formula W=Fd doesn't prove that gravity does work on the car, the kinetic energy comes from the change in gravitational potential energy. How is the energy transferred if gravity doesn't do work on the car? What is the relationship between energy transfer and work done? Do they contradict each other or what? Thanks!

Best Answer

Gravity does work on the falling block, which then does work on the car (through some gearing). We could detail it a bit more and say that the block actually does work on the wheels that are being turned, which then in turn cause the friction from the ground to do work on the car.

The work done by gravity is what we call change in potential energy.