At each end of the oscillation, when the displacement is at a maximum, the mass is momentarily still. It has zero kinetic energy but maximum potential energy.
In the case of a spring (pictured here) this potential energy is stored elastic energy. In the case of a pendulum it is gravitational potential energy.
At the centre point of oscillation the speed of the mass is at a maximum. The kinetic energy is therefore at a maximum and the potential energy is zero.
A freely oscillating spring or pendulum loses energy very slowly. The energy converts from potential to kinetic and back in a continuous cycle; the total energy remains constant. (Law of conservation of energy)
The other pages of notes on SHM may be useful to you: