Scientists believed that the movement of the Earth's plates bends and squeezes the rocks at the edges of the plates. Sometimes this bending and squeezing puts great pressure on the rocks.
Rocks are somewhat elastic, they can be bent without breaking.
Rock layers act somewhat the same way, if the pressures becomes too great the rock layer will break and move. When this occurs the layers will move along a crack in the Earth's crust called a fault or the release of energy will cause a new faultline to be produced. This rupture of the rocks and the resulting movement causes an earthquake.