$\newcommand{\til}{\tilde}$ $\newcommand{\GL}{\operatorname{GL}^+}$
Let $(M,g)$ be a complete Riemannian manifold. Let $S \subseteq M$ be a topologically closed, connected embedded submanifold of $M$, and let $i:S \to M$ be the inclusion map.
Let $d^{Int}_S$ be the intrinsic distance induced on $S$ by $i^*g$, and let $d^{Ext}_S$ be the extrinsic distance of $M$ restricted to $S$.
Soft question:
Find necessary and sufficient conditions for $d^{Int}_S = d^{Ext}_S$.
Some partial results:
Claim 1: Suppose that $S$ is topologically closed in $M$:
Then $d^{Int}_S = d^{Ext}_S$ if and only if between any two points $p,q \in S$, there is a geodesic of $M$, which lies completely in $S$, and is length-minimizing (among all paths in $M$) between $p$ and $q$.
A proof is here.
When $S$ is not closed, this does not need to hold; Look at $M=\mathbb{R}^2,S=\mathbb{R}^2\setminus \{(0,0)\}$.
Claim 2 (easy): If $d^{Int}_S = d^{Ext}_S$, then $S$ is a totally geodesic submanifold of $M$.
This condition is not sufficient. Here is one way to see that:
First, we need to following result:
Lemma 1: Nearly length minimizing paths are close to geodesics.
Let $p,q \in M$. Then for any $\epsilon >0$ there exist a $\delta >0$ such that, if $\alpha$ is a path between $p,q$ such that $L(\alpha) < d(p,q) + \delta$ then $\alpha$ is in an $\epsilon$-neighbourhood of some minimizing geodesic $\gamma$ joining $p,q$. That is, there exists a reparametrization $\alpha \circ \varphi:I \to M$ and a minimizing geodesic $\gamma:I \to M$ joining $p,q$ such that $\forall t \, \,d\big((\alpha \circ \varphi)(t),\gamma(t)\big) < \epsilon$.
A proof is here.
Corollary 1:
Let $p,q \in S$, and suppose that there exists a unique geodesic $\gamma$ in $M$ between $p,q$ which is length minimizing among paths in $M$. If $\,\,\,\operatorname{Image}(\gamma) \cap \big(\overline S\big)^c \neq \emptyset,\,\,\,$ then $d^{Int}_S(p,q) > d^{Ext}_S(p,q)$.
Proof of Corollary 1:
Let $t_0$ satisfy $\gamma(t_0) \in \big(\overline S\big)^c$. Since $\big(\overline S\big)^c$ is open, there is some metric ball $B_{\epsilon}$ with a positive radius $\epsilon$ (w.r.t $d^M$), satisfying $\gamma(t_0) \in B_{\epsilon} \subseteq \big(\overline S\big)^c$.
By Lemma 1, $\exists \delta > 0$ such that if $\alpha$ is a path between $p,q$ satisfying $L(\alpha) < d^M(p,q) + \delta$, then $\alpha$ is in $\epsilon$-neighbourhood of some minimizing geodesic joining $p,q$. By our assumption, there is only one minimizing geodesic between $p,q$ in $M$, which is $\gamma$.
Thus, there exists a reparametrization of $\alpha$, $\alpha \circ \varphi :I \to M$ such that: $\forall t \, \, d\big((\alpha \circ \varphi)(t),\gamma(t)\big) < \epsilon$. In particular, $d\big((\alpha \circ \varphi)(t_0),\gamma(t_0)\big) < \epsilon \Rightarrow (\alpha \circ \varphi)(t_0) \in B_{\epsilon} \subseteq \big(\overline S\big)^c$.
This shows that any path $\alpha$ which is $\delta$-close to being a minimizer intersects $\big(\overline S\big)^c$. Hence $d^{Int}_S(p,q) \ge d^{Ext}_S(p,q) + \delta $
A nice example: $M=\mathbb{R}^{n^2},S=\GL$, the group of matrices with positive determinant. $\GL$ is open in $M$, hence totally geodesic. There exist elements in $\GL$ such that the straight segment connecting them passes through matrices with negative determinant, it follows by corollary $1$, that $d^{Int}_S > d^{Ext}_S$. (see discussion here).