A capacitor is a device for storing energy in the electric field between the plates.
Charges move from one plate to the other and as they do this they deliver energy to any components inbetween the plates. It is a common miscomception that the charges give up all of their energy. They only give a maximum equal to the potential difference across the capacitor's plates. But at the capacitor discharges, it loses charges and therfore changes the potential difference.