A sufficient condition is that
- any two points of $X$ can be joined by a local geodesic (it does not have to be globally minimizing), and
- geodesics do not split: if two geodesics share an arc, they coincide.
In the literature, the latter condition is usually stated simply as "geodesics do not split".
Suppose the above hold. Given any point $x\in X$, join it by a (local) geodesic to a point $y\in U$. Its image under $F$ is also a geodesic, but since $U$ is fixed pointwise, the two geodesics coincide within $U$. Therefore, they coincide, and $F(x)=x$.
Here is an counterexample showing the importance of non-splitting of geodesics. Let $X$ be $\mathbb R^2\setminus \{(x,0): x\ne 0\}$, with the intrinsic metric (i.e., the distance between points is the length of the shortest curve between them). This is a geodesic space: moreover, any two points are joined by a unique distance-minimizing geodesic. The map
$F(x,y) = (x\operatorname{sign}y , y )$ is an isometry which fixes the upper halfplane pointwise but is not the identity.
Slight variation of the above: To give an example where $X$ is complete, let $X=\{(x,y)\in \mathbb R^2:|y|\ge |x|\}$, also with the intrinsic metric. The same $F$ works.
The geodesic language is cumbersome here because in the metric space world, it usually means a globally-length-minimizing curve, while in Riemannian geometry it means a locally-minimizing curve.