A capacitor will only charge to the voltage of the battery you connect it to. The voltage rating - 400 volts in your case - indicates the maximum safe voltage you can charge your capacitor to. If you try to charge it to a higher voltage, the capacitor may be damaged.
With large-valued capacitors and batteries with high current capability, you should put a resistor in series to limit the peak current. Otherwise, you can get arcing and accompanying hot metal splatter.