A calorie in physics is the energy required to raise the temperature of 1 gram of water 1 °C.
The calorie you see on a food package is actually a kilocalorie, or 1,000 calories, the amount of energy needed to raise the temperature of 1 kilogram of water 1 degree Celsius.
The original method used to determine calories in a given food directly measured the energy it produced. The food was placed in a sealed container surrounded by water, a bomb calorimeter. The food was completely burned and the resulting rise in water temperature was measured.