It's just the definition of force.
Force is defined as a disposition to deviate from the “straight-line path.” If you derive the equations of motion in rotating coordinates, for example, you naturally see two “fictitious force” terms, the Coriolis and centrifugal forces, that apply uniformly to every object proportional to its mass—that is, these are really universal accelerations independent of mass. Your “straight lines” are curvy relative to the non-rotating “straight lines,” but we compensate by inventing these accelerations and we can do physics with either.
Then you are free to take your coordinates seriously and imagine that these are real forces, as one might imagine a geocentrist doing. That’s fine and it’s also the traditional approach to gravity: it's a real force between masses.
Or, you might go the other way. Seeing these universal accelerations you might wonder what coordinates you can transform to, to insert their opposites and perfectly cancel them out. So you might assume that your coordinates are “in error” and the true “straight line” is not measured relative to the fixed objects around you that co-rotate with your coordinates, but rather relative to some other coordinate system—as a heliocentrist would do.
Our term “fictitious” forces above indicates what side we’re usually on with rotations of course. But it is just a word. Truly, both reference frames lead to the exact same mathematics and hence the same physical predictions: there is no experiment which can decide whether geocentrism or heliocentrism is right. In fact what prevails across science history is just what makes calculations easier for overworked graduate students, a sort of natural selection which we can also imagine as Occam’s razor, if we ignore the sorts of pop cultures that can also self-reinforce. This is also why we still teach gravity as a universal force first and only as a coordinate failure second: the latter requires much more work from our students in the nonrelativistic case.
Faced with a gravitational force—which also scales like mass and therefore is secretly an acceleration—one can play the same trick, imagining that gravity is a “fictitious” force caused by not using the “correct” coordinates. Then if the only force is gravity, one can imagine that the correct coordinates are “free-falling” ones, such that an object undergoing free-fall is at rest or moving in a “straight line,” a geodesic. This is what Einstein did. It's no law, but a concrete choice he made.