Glucose contains too much energy for the cell to use. In order to compensate for the overabundance of ATP produced by glucose metabolism, some ATP has to be wasted at the beginning of the process.
Glucose is a stable molecule. A certain amount of "activation" energy must be added before the molecule will release all of its stored energy.
Glucose is an unstable molecule. Without the addition of the two ATP molecules, the glucose molecule will spontaneously release all of its energy in the form of heat.
Glucose really has no energy. All of the later ATP molecules that are harvested are actually a result of the energy added to the molecule by these first two initial ATP molecules.