The reason this works is beyond the chemical benefits. We are story driven creatures and physical activity gives us the feeling that we have accomplished something positive. Optimism about the future is very important and also accomplishing goals makes us feel optimistic. You can also get similar benefits by doing any small task which is meaningful to you.