The First law of thermodynamics also known as Law of Conservation of Energy states that energy can neither be created nor destroyed, energy can only transferred or changed from one form to another. For example. Turning on a light would seem to produce energy. However, it is electrical energy that is converted.
This law says that there are two kinds of processes, heat and work, that can lead to change in the internal energy of a system. Since both heat and work can be measured and quantified, this is the same as saying that any change in the energy of a system that can change in the energy of a system must result in a corresponding change in the energy of the surroundings outside the system. In other words, energy cannot be created or destroyed. If heat flows into system or the surroundings do work on it, the internal energy increases and the sign of q and w are positive. Conversely, heat flow out of system or work done by the system will be at the expense of internal energy and q and w will therefore be negative.