Food energy comes mainly from carbohydrates, protein, and fat from the food humans eat. Food energy usually comes from carbohydrates and fats rather than proteins. Energy is usually consumed because of various metabolic and enzymatic processes; and any excess in energy is stored as fat (in adipose tissue) and glycogen (in the liver and in muscles). Food energy that are not used are lost as heat.
Producing heat is not actually a byproduct of the inefficiency of metabolism. Heat is actually used to maintain core body temperature to make sure that thermosensitive enzymatic processes are not inhibited.