Answer: As soon as food is digested it is used for immediate energy needs (blood sugar), stored for future use (fat or glycogen stores) or used to replace or rebuild tissues (e.g. muscles or protein tissues). In other words, any digested food (protein, fat or carbohydrates) not immediately used will be stored and used as needed until you eat again. And keep in mind that all the macronutrients can be converted to energy for use or storage, including protein.
Humans are periodic eaters but continuous metabolizers. At rest, or during most non-active times of the day, the body will use 40-100 calories per hour depending on one’s size. This occurs no matter what, even if you are sleeping. Foodstuffs start entering the body soon after consumption and will continue over the next 2hrs depending on the size, contents or mix of the meal. When we eat, we will always bring in more calories than we will immediately use for energy needs, hence the ability to store carbohydrate in the muscles and liver as glycogen and fat and any excess protein or carbs in adipose tissue (fat stores). While all of this is going on the body is still burning and using calories. A few hours after a meal, the internal hormonal environment changes and stored energy begins to leave adipose tissue, accompanied by a trickle of glucose from the liver. Higher muscular work will also increase energy usage and specifically the use of glycogen stored within the working muscles. So at the end of the day whether you gained fat or muscle is determined by your total energy intake versus your energy used and the type of exercise performed. Additionally, there is likely some genetic and/or hormonal influence variability that determine exactly how much is put in fat versus muscle, but everyone has the ability to gain or lose muscle and fat.