Where does energy goes when I work out? Let's say I am using a machine to lift weight by pulling a bar.
When I do that, the state of the machine is exactly the same at the beginning and the end of the workout; no heat has been generated since it's just weight lifting.
If I replaced the weight by a mechanism to generate electricity, I will do the exact same workout and it will have the exact same effect on my body, but instead of ending up with a machine in the same state as the beginning, I end up with electricity!
In this case I understand that the electricity is the result of my effort but in the case of the weights, where is the energy going?
 A: Ooh tricky question, I like those!  Let me simplify the question a bit because I think it will become much more clear where the difference is.
Simplified proxy question:

Imagine you have lifted a bucket of water from the ground up to waist height.  You now have the option of pouring the water out of the bucket onto the ground, or, pouring the bucket onto a water wheel which will turn and generate electricity.  In one case, you get nothing from pouring the water on the ground, and in the second case, you get useful electricity.  How is pouring water onto the water wheel better than pouring water onto the ground?

The answer to the simplified question is that when you pour water onto the ground, the water strikes the ground with a high velocity and generates heat due to the inelastic collision with the ground and the friction (viscosity) of the water.  When you pour water onto the water wheel, the wheel slows the water down and extracts the potential energy from it so that when the water finally reaches the ground it has much less energy to give up.
So, pouring the water on the ground wastefully release all the energy at once when it hits the ground.  Pouring it on the water wheel extracts some useful energy from it reducing the amount wasted on the ground.  The total amount of energy spent by your body and the total amount of energy released is the same in both cases.
Your exercise question is just a slightly more complicated version of this.  If you setup the exercise with weights versus exorcise with a generator so that the workout to your body is the same, then you will be able to find where the energy with the weights is being released as waste.
