Why is my equation for getting the energy of a capacitor wrong?
You missed one very importent fact: The discharged capacitor has zero volts.

On other words: Voltage is not a constant, but a linear function. That is where the integrale (thanks @jonk) originates.

So the "real" formular is U=∫CV which yields U=1/2 * C * V² after integration.