First law of thermodynamics applied to mechanical and gravitational systems
The work in the first law is exactly the usual work $W=\int Fdx\rightarrow\int PdV$. For point particles, this is enough to completely specify the behavior of the system using Newton's first law, or energy methods. However, for macroscopic objects, the motion of the internal components (in thermodynamics these would be particles) have some additional degrees of freedom. Statistically, we can use the temperature to tell us things about "how much" energy the system has on its own, so changes in temperature can tell us how much its energy changes.
So the first law $\Delta U=Q-W$ tells us that we have to take care of heat transfer ($Q$) as well as the work ($W$) that is done on the system. Of course, these two quantities are not completely decoupled as I have described, but this is my intuition for how this works.