Generalization of Inverse Function Theorem to noncompact submanifolds
We can show that any two elements of the refined collection $\{g_i\}$ that are defined at $y$ have a nonempty open set around $y$ on which they agree:
Suppose we have two neighborhoods $V_i=f(U_i)$ and $V_j=f(U_j)$ of $y =f(z) \in f(Z)$ together with local inverses $g_i$ and $g_j$. Then we have $$g_i(V_i) \cap g_j(V_j)=U_i \cap U_j \subset X,$$ which is an open neighborhood of $z$ in $X$. Thus the set $$V=g_i^{-1}(U_i \cap U_j) \cap g_j^{-1}(U_i \cap U_j) $$ is an open neighborhood of $y$ in $Y$ on which $g_i$ and $g_j$ are both defined. Moreover, for $y' \in V$, we have $$f(g_i(y'))=y'=f(g_j(y'))$$ and thus $g_i(y')=g_j(y')$ because $f$ is one-to-one.
Suppose $f: X \to Y$ maps $Z \subset Y$ diffeomorphically onto $f(Z) \subset Y$.
Since $df_x: T_x(X) \to T_y(y)$ is an isomorphism for each $x \in Z$, there exist open sets $x \in U_x \subset X$ and $V_x \subset Y$ such that $f$ maps $U_x$ diffeomorphically onto $V_x$ by the Inverse Function Theorem presented as Exercise 1.3.10 of Guillemin-Pollack (the compact version).
The $\{V_x\}_{x \in X}$ forms an open cover of $f(Z)$, since $f(x) \in V_x$. Now, apply Exercise 1.8.13 of Guillemin-Pollack (every open cover of $\{V_\alpha\}$ of a manifold $X$ has a locally finite refinement) to take a locally finite refinement, which we will call $V_i$, with local inverse $g_i: V_i \to X$, such that $f \circ g_i = \text{Id}_{V_i}$.
Define $W = \{y \in Y: g_i(y) = g_j(y) \text{ whenever }y \in V_i \cap V_j\}$. On $W$, it is clear we can define a global inverse $g: W \to X$ by taking $g(y) = g_i(y)$ for any $i$ such that $y \in V_i$. This is well-defined on $W$ as $g_i(y) = g_j(y)$ whenever $y \in V_i \cap V_j$.
$W$ contains $f(Z)$, as $f$ maps diffeomorphically on $f(Z)$, so $g_i(y) = g_j(y) = f^{-1}(y)$ for any $y \in Z$. Now fix a $f(x) \in f(Z)$. We wish to show that $W$ contains an open neighborhood of $f(x)$. By the property that $\{V_i\}$ is a locally finite cover of $f(Z)$, there exists a neighborhood $V$ of $f(x)$ that intersects only finitely many of the $V_i$ – by reindexing them, if necessary, call them $V_1, \dots, V_k$.
Then $\widetilde{V} = V \cap V_1 \cap \dots \cap V_k$ is a finite intersection of open sets that contain $f(x)$, so $\widetilde{V}$ is an open neighborhood of $f(x)$. Moreover, on $\widetilde{V}$ each $g_i$ is a local diffeomorphism with $g(\widetilde{V}) \subset U_i \ni x$. Hence, on $\widetilde{V}$, the $g_i$ all agree, so $\widetilde{V} \subset W$. So we are done.