Chemistry is awesome.
Of course, when this experiment is done, you can no longer investigate Gummi anatomy. Such sacrifices are sometimes necessary.
And before I let you go…
[Note added later: apparently, according to a few commenters below, the acid I describe is only needed if you don’t heat the perchlorate; they do in fact use a flame in the video. Still, who can resist a bit of chemistry?]
I think the video leaves out an important part: you need a bit of sulfuric acid to make this work. Adding the acid to potassium chlorate yields chloric acid and potassium sulfate:
2 KClO3 + H2SO4 → 2 HClO3 + K2SO4
Sugar reacts, um, strongly to the chloric acid:
8 HClO3 + C12H22O11 → 11 H2O + 12 CO2 + 8 HCl
You can see the water coming out of the test tube in the form of steam — the reaction is highly exothermic — and the purple flame is from potassium being heated. At the same time, a second reaction occurs, breaking up some of the sugar molecules into carbon and water. When the flames and sturm and drang are all done, what’s left is a black residue: carbon, the burnt remains of the tasty, tasty Gummi bear.