In this paper, we elaborate on the connection between the fundamental equation of thermodynamics, which is essentially the combination of the First and Second Laws of thermodynamics, and the energy balance equation in the context of closed and open systems. We point out some misinterpretations in attempts to derive the fundamental equation from these First and Second Laws of thermodynamics, which occur in several textbooks. These errors are connected with incorrect interpretations of heat and work terms in relation to changes of the entropy and internal energy change of the system. The consequences of matter transfer for the formulation of the First and Second Laws are often not properly taken into account, and there is a widespread misinterpretation of what is called ‘chemical work’. In this paper, we present a correct derivation of the fundamental equation from the basic laws of thermodynamics, through a careful analysis of matter transfer to an open system. This provides insight into the meaning of ‘chemical work’.