Dear student,
Water stored in the dam has potential energy as the water is raised to a height which allows it to gain potential energy.As potential energy is a function oh height given by,
P.E=mgh
Once the water is falling, this potential energy gets converted to kinetic energy.
Regards