A geodesic is a curve $\gamma$ which extremizes the path length functional
$$S[\gamma]= \int d\lambda \ L(\gamma,\dot \gamma) =\int d\lambda \sqrt{g_{\mu\nu}(\gamma)\dot\gamma^\mu\dot\gamma^\nu}$$
The Euler-Lagrange equations are
$$\frac{\partial L}{\partial \gamma^\alpha} = \frac{d}{d\lambda}\frac{\partial L}{\partial \dot\gamma^\alpha}$$
$$\implies (\partial_\alpha g_{\mu\nu})\dot \gamma^\mu\dot\gamma^\nu = \frac{d}{d\lambda} \left(2g_{\alpha\nu} \dot \gamma^\nu\right) = 2\partial_\mu g_{\alpha\nu} \dot \gamma^\mu \dot\gamma^\nu + 2g_{\alpha\nu} \ddot \gamma^\nu$$
$$\implies \ddot \gamma^\nu + \frac{1}{2}g^{\alpha\nu} (2\partial_\mu g_{\alpha\nu} - \partial_\alpha g_{\mu\nu} )\dot \gamma^\mu \dot \gamma^\nu = 0$$
which can be rewritten as
$$\ddot \gamma^\nu + \frac{1}{2} g^{\nu\alpha}( \partial_\nu g_{\alpha\mu} + \partial_\mu g_{\alpha \nu} - \partial_\alpha g_{\mu\nu})\dot \gamma^\mu \dot \gamma^\nu = 0$$
This is the geodesic equation. It depends only on the metric, and has precisely nothing to do with the connection.
An autoparallel is a curve $\gamma$ whose tangent vector is parallel-transported along itself; in other words, the covariant derivative of $\dot \gamma$ along $\gamma$ is equal to zero:
$$\nabla_{\dot \gamma} \dot \gamma =0$$
$$\implies \ddot \gamma^\alpha + \Gamma^\alpha_{\ \ \mu \nu} \dot \gamma^\mu \dot \gamma^\mu = 0 $$
where $\Gamma^\alpha_{\ \ \mu\nu}$ are the connection coefficients defined by $\frac{\partial \hat e_\nu}{\partial x^\mu} = \Gamma^\alpha_{\ \ \mu\nu} \hat e_\alpha$. This has precisely nothing to do with the metric.
Now we bring these things together by demanding that the autoparallels coincide with the geodesics - that is, that the shortest (or longest) lines are also the straightest lines. We must then have that
$$\Gamma^\alpha_{\ \ \mu\nu}\dot \gamma^\mu\dot \gamma^\nu = \frac{1}{2} g^{\nu\alpha}( \partial_\nu g_{\alpha\mu} + \partial_\mu g_{\alpha \nu} - \partial_\alpha g_{\mu\nu})\dot \gamma^\mu \dot \gamma^\nu$$
Since $\dot \gamma$ is arbitrary, one is tempted to simply drop the $\dot \gamma$'s from both sides, but this would be getting slightly ahead of ourselves. Note that $\Gamma^\alpha_{\ \ \mu\nu} = \Gamma^\alpha_{\ \ [\mu\nu]} + \Gamma^\alpha_{\ \ (\mu\nu)}$, and the antisymmetric part will be annihilated when contracted with $\dot \gamma^\mu\dot\gamma^\nu$ (which is symmetric). As a result, demanding that autoparallels = geodesics determines only the symmetric part of $\Gamma$.
However, if we also demand that $\Gamma^\alpha_{\ \ [\mu\nu]}=0$ - that is, that the connection be torsion-free - then our connection is uniquely determined by the metric. This is the Levi-Civita connection:
$$\Gamma^\alpha_{\ \ \mu\nu} = \frac{1}{2} g^{\nu\alpha}( \partial_\nu g_{\alpha\mu} + \partial_\mu g_{\alpha \nu} - \partial_\alpha g_{\mu\nu})$$
It must be emphasized that this is a particular choice of connection that we are making. The metric and the connection are, in principle, completely separate objects which we are choosing to be related to one another.