Contrary to popular belief the Earth is not solid all the way through and is honeycombed with cracks, fissures and caverns of immense size. The Earth's outer crust or mantel is made up of a series of plates that are constantly shifting and moving. As pressure builds up these plates slip under or over each other mostly gradually but sometimes significantly.
The significant shifts are known as Earthquakes. These earthquakes occur due to many variables including but not limited to the heating of the Earth's core, magnetic influences, other planetary bodies and vibrations from the moving plates.