In thermodynamics, we study the transfer of energy, but also we study the law of conservation of energy that states energy can't be destroyed or created, just transformed. This means when we use energy, it ends in form of heat and carbon dioxide, where the last one has a negative impact on the environment.
In other words, the more energy we transformed to do specific tasks like producing oil, we are adding more carbon dioxide and heat to the environment, polluting the environment.
Therefore, if we minimize non-useful energy transformation, then we reduce heat and carbon dioxide products, as a consequence, we contribute positively to the environment.