There is no “theory of relativity” — only two theories that both occasionally fall under the same designator — the theory of special relativity and the theory of general relativity. Both were devised by the famous physicist Albert Einstein between 1905 and 1915. Both these theories upended Newton’s classic mechanics, which had held for centuries prior.
The special theory of relativity is a theory of the structure of spacetime, which asserts that 1) the laws of physics are the same for all observers in uniform motion relative to one another and 2) the speed of light in a vacuum is the same for all observers, regardless of their motion of the motion of the light source. This leads to bizarre consequences. For instance, imagine moving on a train going 100 mph next to another train moving in the same direction at 100 mph. From your perspective, the train next to you looks almost still. But imagine being on a train moving at the speed of light, while next to a light beam. Instead of the light beam looking like it’s staying still, it moves ahead of you at the speed of light. Light is strange that way.
Several of the consequences that follow from the special theory of relativity are 1) time dilation (clocks moving near the speed of light operate more slowly than stationary clocks), 2) length contraction (objects moving near the speed of light appear to be contracted in the direction of motion), 3) relativity of simultaneity (things that appear to happen at the same time to stationary observer A may appear to happen at different times to moving observer B), 4) mass-energy equivalence (mass and energy are essentially the same thing and transmutable into each other).
The general theory of relativity, which was conceived a few years after the special theory of relativity, is a theory of how gravity works. It was initially based on the equivalence principle, the idea that acceleration and standing still in a gravitational field of a given strength are physically identical. Because no special force is required to create inertial effects in an accelerating object, Einstein proposed we should think the same way about gravity, forgoing the classical notion of gravitational force and instead conceiving of gravity as curves in spacetime. This explains phenomena like why light bends in the presence of a gravitational field even though it lacks mass.
The general theory of relativity provides explanations and makes predictions that would have seemed ludicrous in the worldview of classical mechanics. Aside from light bending in the presence of a gravitational field, it predicts that time goes more slowly in the presence of a gravity field, planetary orbits precess (change) due to torque exerted by the Sun’s gravity field, frame-dragging occurs, whereby massive rotating bodies “drag” the inertial frame of the surrounding spacetime around with it, and that the universe is expanding, in some cases faster than the speed of light, because it’s the space itself that’s expanding, not objects within it.
Unraveling the implications of these theories took decades, and is still ongoing today. Einstein’s theories were so forward-looking that it took decades to test and confirm them with great precision. In hindsight, Einstein’s ideas were almost completely validated.