Well, I've always imagined the reactor to be the main power source, (ofc) which powers all other power-consuming devices on the ship (obviosly). However, the reac prolly can't spool up / down to aweful quickly (modern ones can't), as well as not being able to dump excessive amounts of energy at once. Hence, you have capacitors, for two reasons: One, to cover short, high demands of energy by such devices as beam cannons and (where applicable) shields. Two, to serve as a backup in case the reac or power distribution unit has a hiccup.
Now, as a side effect, when everything goes down the tubes, and these capacitors short out, you get some nice explosions.
Oh, and don't try this at home (unless you are foolhardy like me and my brother): Take a disposable camera with a flash, and after you're done with the film, open up the case, pull the circuit board out, stick a battery inside, charge it up, and short out the capacitor with a butter knife. Keep in mind that if you short it out with your skin, you will prolly get a small 3rd degree burn, like my brother did. XD (I was always more cautious.) Oh, and I'm not responsible if the capacitor blows up, or you short yourself out and get a third degree burn, etc, etc... I'd wear gloves if I was squeemish.