Einstein's path to general relativity began with a thought he later called the happiest of his life: a person falling freely feels no gravity at all, so the pull of gravity and the acceleration of a reference frame are, locally, indistinguishable. He reached this equivalence principle around 1907, eight years before he published the finished theory, and spent the intervening years working out its mathematical consequences with the help of his friend, the mathematician Marcel Grossmann, who introduced him to the differential geometry needed to describe curved, four-dimensional spacetime.
The theory Einstein published in November 1915 replaced Newton's picture of gravity as a force acting instantly across empty space with a geometric one: mass and energy curve the fabric of spacetime itself, and objects moving through that curved spacetime follow paths that look, from a distance, like the effect of a gravitational pull. A planet orbits the sun not because the sun reaches out and tugs on it but because the sun's mass bends the spacetime the planet is traveling through, and the planet is simply going the straightest available path. The field equations Einstein derived describe precisely how mass and energy determine that curvature, and how that curvature in turn determines how mass and energy move.
The theory made a specific, checkable prediction that Newton's gravity could not: light itself, though massless, should be bent by the sun's gravity by a calculable amount, twice what a naive Newtonian estimate would give. Confirming that prediction, four years later, turned Einstein from a respected physicist into a household name, and general relativity has since passed every experimental test put to it, from the precise orbit of Mercury to the detection of gravitational waves a century after the theory was published.