the water wheel itself does a credible job of converting gravitational potential energy into mechanical energy. but not with 100+% efficiency. and a water wheel is not a closed system. the complete system with the water wheel would have to include a large body of water, sunlight, precipitation, and runoff collection. the total efficiency is actually pretty low. Hydroelectric power isn't 'free' energy, it is diffuse solar energy used to evaporate water, which is collected by mountains and channeled into valleys, and then has power extracted by water wheels. one of the first and most important lessons of thermodynamics is to be very clear about what the 'system' under study actually is and what it actually isn't.