I forget who said it, but it's a good rule of thumb "Mass-energy tells space how to bend, space tells mass-energy how to move."
Space-time has a certain shape. Just as the shortest distance between two points is not a straight line on the surface of a globe is not a straight line, the shortest distance between two points in space-time is also not a straight line under the influence of gravity .
The shortest distance path on a surface is called a geodesic, whatever the shape of the surface. So a great circle on a sphere is a geodesic, so is a straight line on the euclidean plane. One is not the same as the other, but they both are the paths an object would take if it is not under the influence of an external force.
Consider the graph of the function $y=x^2$. And suppose you travel along that graph at a constant speed.
$$y=x^2$$
$$\dot{x}^2+\dot{y}^2=u^2.$$
From this it follows that:
$$\dot{x}=\frac{u}{\sqrt{1+4x^2}}$$
$$\dot{y}=\frac{2xu}{\sqrt{1+4x^2}}$$
So,
$$\ddot{x}=\frac{4xu}{(1+4x^2)^\frac{3}{2}}$$
$$\ddot{y}=\frac{-2u}{(1+4x^2)^\frac{3}{2}}$$
It's clear that despite maintaining a constant speed, there is a changing velocity, an acceleration since the second derivatives with respect to time are non-zero. But acceleration in the absence of an applied net force is a pseudo-force.
Now the curvature of a curve is $k=\frac{\frac{d^2y}{dx^2}}{(1+(\frac{dy}{dx})^2)^\frac{3}{2}}=\frac{2}{(1+4x^2)^\frac{3}{2}}$ in the case of our curve here.
Notice that $k$ divides both acceleration terms. This is no coincidence.
Let $\frac{d\vec{s}}{dt}$ be velocity along the path. By definition, curvature is :
$$k=\frac{d\theta}{ds}$$ where $\theta$ is $tan^-1(dy/dx)$.
Another definition of curvature is $\frac{d\vec{T}}{dt}$, where $\vec{T}$ is the unit tangent vector to the curve, i.e. $\vec{T}=\frac{d\vec{s}}{ds}=\frac{d\vec{s}/dt}{ds/dt}$
Now $ds/dt=u$ and we are holding $u$ constant, so $du/dt=0$.
So $\frac{d}{dt}(\frac{d\vec{s}/dt}{ds/dt})=\frac{1}{u}\frac{d^2\vec{s}}{dt^2}=\vec{k}$
So we expect the acceleration to be the product of the constant velocity and the curvature.
Notice from this, if we have no curvature, we have no acceleration. Zero curvature implies a straight line and no pseudo-force.
Curvature has a broader definition in 4d space-time.
The equation of geodesics becomes:
$$\frac{d^2x^a}{dt^2}=\sum_{\mu=0}^3\sum_{\nu=0}^3-\Gamma_{\mu\nu}^a\frac{dx^\mu}{dt}\frac{dx^\nu}{dt}$$
Here $x^a$ means the $a_{th}$ component of path $\vec{s}$.
$\Gamma^a_{\mu\nu}$ is the Christofel Symbol of the Second Kind.
Notice again we have a second time derivative being the product of some first time derivative. As it happens the Christofel Symbol has a close relation to curvature.
The Stress-Energy Tensor, roughly equivalent to the mass distribution of Newtonian Gravity, dictates curvature of your region of space which can be expressed in terms of the Christofel Symbols.
If we know the Christofel Symobols, then the geodesic equation will tell us the path particles will take in the absence of an applied force. It will tell us how photons move.
Notice the geodesic equation makes no explicit reference to some mass energy distribution. The Christofel symbols dictate our geometry. All we need to know is the geometry to find our paths.
So that quote above actually breaks up the problem of General Relativity. Understanding geometry of space time, and understanding how that is manipulated by mass energy. For the sake of theoretical work, they can be given arbitrarily to see what paths result.
So curvature determines which paths exist in the first place and and light "selects" the Least Time Path according to Fermat's Principle.