The heat capacity of a substance generally changes when it undergoes a phase transition, such as from a gas to a liquid and then back to a gas. Let's consider the specific case of water as an example.
When water changes from a gas (water vapor) to a liquid state (water), it releases heat energy, and this process is known as condensation. During condensation, the heat capacity of water decreases. The heat capacity is the amount of heat energy required to raise the temperature of a substance by a certain amount. As water vapor condenses into liquid water, the heat capacity decreases because the energy released during condensation reduces the amount of heat energy needed to raise the temperature.
On the other hand, when liquid water changes back to a gas through the process of vaporization (evaporation or boiling), it absorbs heat energy from the surroundings. During vaporization, the heat capacity of water increases. The heat capacity increases because additional heat energy is required to break the intermolecular forces holding the liquid molecules together and convert them into individual gas molecules.
Therefore, during the transition from a gas to a liquid (condensation) and from a liquid to a gas (vaporization), the heat capacity of a substance undergoes changes. It decreases during condensation and increases during vaporization. These changes in heat capacity are related to the specific thermodynamic properties of the substance and the energy exchange that occurs during phase transitions.