There are about 20 plates along the surface of the earth that move continuously and slowly past each other.
The release of pressure caused by the grinding together of the tectonic plates.
Imagine the Earth's outer layer as being cracked into many pieces.
These pieces, called tectonic plates "float" on the melted core of the earth, allowing them to shift around ever so slightly.
As they shift, they grind against each other.and build up pressure until the two plates slip, releasing their energy in what we feel as an earthquake.
If you slowly but firmly rub your hands together you can feel how they seem to stick for a moment before finally sliding, it's the same thing with the tectonic plates.
There are two tectonic plates that meet under California, that's why there are so many earthquakes there.