the body has an energy balance:
Energy IN = Energy OUT
If there is a difference between the values on either side of the equation then body weight must change because this implies that calories (energy) has either been added to the body, or lost. Since energy is stored chemically as glycogen (a polymer of glucose) or as fat and theses weigh something then increasing or decreasing the total amount of them must alter body mass.
In terms of when calories are stored and burned, sugars absorbed from the diet are turned into glycogen in the liver and in muscle. Any excess is turned into fat. When the body runs short of energy (and blood sugar falls) the hormone gluacagon is released from the pancreas which triggers the liver to break down glycogen to glucose again and add this to the bloodstream. This is a very fast process, enabling blood sugar to be supported very rapidly.
The liver contains about 50-100g of glycogen, enough to last about 24 hours in the face of a fast. Glycogen also binds an equal weight of water, so as it burns off the body also loses water, doubling the apparent weight loss. This is why when someone initially commences a diet they are rewarded with apparently high rates of weight loss.
But this quickly slows once the supply of glycogen is used up and the body turns to fat as an energy source, breaking it down by a process called beta oxidation. This process is slow and fat also contains large amounts of energy, so a little goes a very long way. Consequently shedding excess body fat takes a long time. The best way to sustain and support the process is to combine reduced calorie intake with an increase in physical exercise. The exercise helps to maintain lean tissue mass (muscles), which is the main way in which the body burns energy.
So to answer your chocolate counundrum: if you are already fully fed (energy replete) and you eat something high-calorie and full of fat (like chocolate) then this is immediately stored as fat. So unfortunately you cannot eat a chocolate bar today and then go jogging tomorrow to get rid of the extra 300 calories, because it's already sitting on your hips!