There are two main causes for earthquakes: explosive volcanic eruptions and plate margins. Most of the earthquakes are caused by plate movements.
The earth's surface is made of plates of rocks which moves constantly. The movement of plates causes up-heaving and instability, which is called Plate Tectonics.
When plates move and interact with each other, the pressure is built up. Once the pressure reaches certain point, it overcomes the tendency of the plates to press together and release their energy, which results earthquakes.