Fix a point $x_0 \in M$. Then let $x = \exp_{x_0}(t v)$ and $y=\exp_{x_0}(t w)$, with $v,w \in T_{x_0}M$.
Then we have the following formula for the distance squared between two geodesic emanating from $x_0$
$$ d^2(\exp_{x_0}(t v),\exp_{x_0}(t w)) = |v-w|^2t^2-\frac{1}{3}R(v,w,w,v) t^4 + O(t^5)$$
whre $R$ is the Riemann curvature tensor. From here you can derive an expression where you follow the two geodesics for different times (just rescale $w \to s/t w$), that is
$$ d^2(\exp_{x_0}(t v),\exp_{x_0}(s w)) = |v|^2t^2 +|w|s^2 -2 g(v,w) ts -\frac{1}{3}R(v,w,w,v) s^2 t^2 + O(|t^2+s^2|^{5/2})$$
Take now $|v| = |w|=1$, then $(t,v)$ and $(s,w)$ (both $\in [0,\epsilon) \times \mathbb{S}_{x_0}^{n-1}$) are polar coordinates of $x,y$. More explicitly, setting $t = d(x_0,x)$ and $s = d(x_0,y)$, you have
$$ d^2(x,y) = t^2 + s^2 - 2\cos\theta t s - \tfrac{1}{3} K_\sigma (1-\cos\theta^2)t^2 s^2 + O(|t^2+s^2|^{5/2})$$
where $\cos\theta = g(v,w)$ is the angle between the two vectors and $K_\sigma$ is the sectional curvature of the plane $\sigma = \mathrm{span}(v,w)$.
As you can see, this can be used effectively as a purely metric definition of sectional curvature, with no connection or covariant derivative whatsoever.