Pressure is force per unit area. In this case the force is primarily the weight of the overlying rock. So , in very simple terms, the deeper you go the more rock must be supported so the more force is required and the pressure goes up. It is basically the same thing that happens in the ocean and in the atmosphere. The deeper you go in the ocean the higher the pressure. And in the atmosphere the higher you go the lower the pressure.