A pendulum is technically NOT simple harmonic motion like a spring. SHM is defined when a force is proportional to the displacement of the object, just like a spring has F proportional to x. A pendulum is close, but the restoring force, being the tangential component of gravity, is proportional to sin(theta). Check out this video to see what we mean by the small angle approximation, or sin(theta) ~ theta (in radians) when theta is small, or about 10-degrees or smaller. This approximation works well, and you should check it on your calculator to prove it to yourself if you are not familiar with this. So for small angles, a pendulum is mathematically the same as an oscillating spring, and therefore is SHM and has a known solution of sine or cosine of wt plus a phase angle.