The sun warms the surface water a lot more than the deep ocean water, and this temperature difference stores thermal energy.
Thermal energy is used for many applications, including electricity generation.
The vapor expands and turns a turbine. The turbine then activates a generator to produce electricity. Open-cycle systems actually boil the seawater by operating at low pressures. Ocean mechanical energy is quite different from ocean thermal energy. Even though the sun affects all ocean activity, tides are driven primarily by the gravitational pull of the moon, and waves are driven primarily by the winds.