The theory of general relativity was invented by Albert Einstein. It is important to net here that the word "theory" can be used in two different ways. Theory can mean an idea that might be true, but is not proven. Theory can also mean a large group of concepts that are connected, forming a body of understanding, that have been proven to be true. In the case of general relativity, the word "theory" is used in the latter sense. It has been experimentally verified in a number of ways.
General relativity describes spacetime as having curvature which depends on the density of matter/energy. This density affects the motion of particles. The particles, in turn, affect the density configuration. In short, matter/energy tells spacetime how to curve, and curvature of spacetime tells matter/light how to move.