As per first law of thermodynamics we know that

here we know that
E = internal energy of the gas
Q = heat given to the system
W = work done by the system
So this is basically energy conservation law in which Q stands for the Heat energy given to the system