Energy Cannot Be Created, Only Moved
Thermodynamics starts by drawing a boundary. The system is what we study; the surroundings are everything else. An open system exchanges matter and energy, a closed system only energy, an isolated system neither.
Energy crosses that boundary in exactly two forms. Heat flows because of a temperature difference; work is everything else, and for a gas it is usually expansion against a pressure:
The sign convention matters. Both and are positive when energy enters the system. A gas that expands does work on its surroundings, so makes negative and the system loses energy.
The first law states that the internal energy changes only by what crosses the boundary:
is a state function: it depends only on the current state, never on how that state was reached. Pressure, volume, temperature, enthalpy, entropy and Gibbs energy are all state functions. Heat and work are emphatically not: you can move between the same two states by many routes, each with a different split of and , yet always the same . This is the whole reason Hess's law works.
A reversible process proceeds through a continuous sequence of equilibrium states, infinitesimally slowly. It is an idealisation, but it is the limit that delivers the maximum possible work, and it is the route entropy must be computed along.
Common pitfall: calling heat a property of a system. A system does not "contain" heat, it contains internal energy. Heat is energy in transit across a boundary, which is why has no value until you specify a process.