When two objects at different temperatures are placed in contact, heat flows from the warmer object to the cooler one until the temperature of both objects is the same.
The amount of heat that flows from a warmer object is the same as the amount of heat that flows into a cooler object. Because the direction of heat flow is opposite for the two objects, the sign of the heat flow values must be opposite.
In line with the law of conservation of energy, the amount of heat lost by a warmer object equals the amount of heat gained by a cooler object. Therefore the amount of heat lost by carbon dioxide is equal to the amount of heat gained by water.