Why did the capacitor blow up?
Your 100uF 400V capacitors were undoubtedly low cost aluminum electrolytic capacitors rated only for use on a DC circuit. When you connect such capacitor to the AC mains you are alternately subjecting the component to a positive peak of the 311V and then -311V at a rate of some 50 or 60 times per second. The polarized plates in the electrolytic capacitor very quickly break down under these conditions and can lead to an internal short. 

Even if the capacitor plates were able to survive the negative voltage for a short time the effective AC impedance of a 100uF capacitor connected to the AC mains without many other series components to limit the current would result in a goodly amount of power being dissipated in the component resulting in the sealed can expanding and exploding.