Albert Einstein delivered two major blows to the established order of physics, through his presentation of special and general theory of relativity, published in 1905 and 1915. While the special theory unified space and time into a single entity, general theory of relativity showed gravity to be an effect of the curvature of spacetime.
Albert Einstein first destroyed Newton's idea of absolute time and then went on to show the flaws in Newton's theory of gravitation, by presenting the general theory of relativity, in 1915. This theory showed that matter bends or warps the spacetime around it and motion of objects is affected by this curvature. Special and general theory of relativity are two separate theories. One describes motion, according to inertial frames of reference, while the other deals with the equivalence of accelerated frames and gravity. One phenomenon that is commonly predicted by both theories is time dilation.
According to Special Relativity
Special theory of relativity is based and derived from two very basic postulates. One states that the speed of light is constant in vacuum and unattainable, while the other states that the laws of physics should remain exactly same in all inertial frames. An inertial frame is any frame that is moving at a constant velocity, with respect to a fixed frame or is at rest with respect to it.
Now, consider a guy sitting in a spaceship, which is moving at a constant velocity in a specific direction with respect to a fixed frame, with no other forces acting on it, other than the spaceship's own propulsive force.
Then, the principle states that time will slow down for the spaceship, with respect to the time associated with the fixed frame. The larger the velocity of the spaceship, more will be the dilation of time and slower will it move for the spaceship. This effect is quantified by the following equation:
Δt' = Δt / √(1 - v2 / c2)
In this physics formula, Δt' is the time interval for a person on the spaceship, while Δt is the time interval for the rest frame of reference. Here, v is the constant velocity of the spaceship and c is the speed of light (3 x 108). The factor - c (speed of light) comes into the picture because the entire theory is based on special relativity, which has constancy of light speed to be its central tenet. The above equation states that the faster the spaceship moves, slower will be its running clocks. This is a consequence of the fact that time is relative and local in nature and not absolute for all.
The degree of dilation is entirely decided by the ratio 'v/c', that is the ratio of the particle's speed, relative to the speed of light. Therefore, the speed of light factor is an essential part of the equation, without which, quantification cannot occur. To know how the equation is derived, you must study special theory of relativity in greater detail.
According to General Relativity
The phenomenon of time dilation due to gravitation is a bit more difficult to grasp and a full understanding will require that you study general relativity. So here, I purely explain the phenomenon but to know why it happens so, you will have to go deep into the theory.
The basic idea is the following. Time slows down in presence of a gravitational potential. The closer an object is to a gravitational potential, slower will time be for it. Thus, for a satellite moving in orbit around the Earth, a clock will be faster, compared to a clock on the Earth's surface.
The gravitational time dilation equation will vary according to the spacetime geometry and therefore, the degree of dilation will entirely depend on the degree of bending of spacetime, caused by a massive object. The spacetime around a black hole is supposed to be so extremely warped, that time virtually comes to a standstill for an object observed falling into it.
To know these things in more detail, you have to deeply explore and understand the special and general theory of relativity. One of the best introductions to special relativity is the book 'Spacetime Physics' by Taylor and Wheeler, which is highly recommended reading, if you want to explore the beautiful and astounding theory. For understanding the general theory of relativity, you will need some mathematical expertise in differential geometry and tensors. A good place to learn it from is 'Spacetime and Geometry: An Introduction to General Relativity' by Sean Carroll. However, know that this is an advanced physics text and will take some hard work to understand. I can assure you that it will all be worth the effort.