Both Work and Heat are forms of energy and the total energy is conserved.
(You may find several paragraphs here, later, each expressing the first law of thermodynamics–the plan is for you to understand the law well enough that you can confirm that each description is correct.)
Q is the heat absorbed from the surroundings
W is the work done on the surroundings.
s