[proofplan]
We prove $\mathbb{Z}_p = \overline{\mathbb{Z}}$ in $\mathbb{Q}_p$ by establishing both inclusions. The inclusion $\overline{\mathbb{Z}} \subseteq \mathbb{Z}_p$ follows from $\mathbb{Z} \subseteq \mathbb{Z}_p$ and the fact that $\mathbb{Z}_p$ is a closed subset of $\mathbb{Q}_p$. The reverse inclusion $\mathbb{Z}_p \subseteq \overline{\mathbb{Z}}$ is the main content: we show that every element of $\mathbb{Z}_p$ can be approximated arbitrarily well by integers in the $p$-adic metric. The key tool is Bezout's theorem, which allows us to approximate $p$-adic integers with rational denominators coprime to $p$ by actual integers.
[/proofplan]
[step:Show $\mathbb{Z} \subseteq \mathbb{Z}_p$ and conclude $\overline{\mathbb{Z}} \subseteq \mathbb{Z}_p$]
Recall that $\mathbb{Z}_p = \{x \in \mathbb{Q}_p : |x|_p \leq 1\}$ is the closed unit ball in $\mathbb{Q}_p$. Every non-zero integer $x \in \mathbb{Z}$ can be written as $x = p^n a$ where $n \geq 0$ and $\gcd(a, p) = 1$, giving $|x|_p = p^{-n} \leq 1$. For $x = 0$, $|0|_p = 0 \leq 1$. Therefore $\mathbb{Z} \subseteq \mathbb{Z}_p$.
The set $\mathbb{Z}_p = \{x \in \mathbb{Q}_p : |x|_p \leq 1\}$ is closed in $\mathbb{Q}_p$ because it is the preimage of the closed set $[0, 1] \subset \mathbb{R}$ under the continuous map $x \mapsto |x|_p$. Since $\mathbb{Z} \subseteq \mathbb{Z}_p$ and $\mathbb{Z}_p$ is closed, the closure satisfies $\overline{\mathbb{Z}} \subseteq \mathbb{Z}_p$.
[/step]
[step:Show that $\mathbb{Z}$ is dense in $\mathbb{Z}_{(p)} := \{x \in \mathbb{Q} : |x|_p \leq 1\}$ using Bezout's theorem]
Let $x \in \mathbb{Z}_{(p)}$ with $x \neq 0$. Write $x = p^n \frac{a}{b}$ where $n \geq 0$, $a, b \in \mathbb{Z} \setminus \{0\}$, and $\gcd(a, p) = \gcd(b, p) = 1$. The condition $|x|_p \leq 1$ gives $n \geq 0$. It suffices to show that $\frac{1}{b}$ can be approximated by integers in $\mathbb{Q}_p$, since then $p^n a \cdot (\text{integer approximation of } \frac{1}{b})$ approximates $x$.
Since $\gcd(b, p) = 1$, for each $i \geq 1$ we also have $\gcd(b, p^i) = 1$. By Bezout's theorem, there exist $c_i, y_i \in \mathbb{Z}$ with
\begin{align*}
b c_i + p^i y_i = 1.
\end{align*}
Rearranging gives $b c_i = 1 - p^i y_i$, so
\begin{align*}
\left|c_i - \frac{1}{b}\right|_p = \left|\frac{bc_i - 1}{b}\right|_p = \frac{|bc_i - 1|_p}{|b|_p} = \frac{|{-p^i y_i}|_p}{1} = |p^i y_i|_p \leq p^{-i}.
\end{align*}
Here we used $|b|_p = 1$ (since $\gcd(b, p) = 1$) and $|p^i y_i|_p \leq |p^i|_p = p^{-i}$. As $i \to \infty$, $p^{-i} \to 0$, so $c_i \to \frac{1}{b}$ in $\mathbb{Q}_p$.
[guided]
The problem is to approximate $\frac{1}{b} \in \mathbb{Q}$ by elements of $\mathbb{Z}$ in the $p$-adic metric. In the archimedean world, this is impossible (the integers are discrete in $\mathbb{R}$). But in the $p$-adic world, $p$-adic closeness means congruence modulo high powers of $p$, and Bezout's theorem provides exactly this.
Since $\gcd(b, p) = 1$, the integer $b$ is a unit modulo $p^i$ for every $i \geq 1$. Bezout's theorem gives $c_i, y_i \in \mathbb{Z}$ with $bc_i + p^i y_i = 1$, which means $bc_i \equiv 1 \pmod{p^i}$, i.e., $c_i$ is the multiplicative inverse of $b$ modulo $p^i$. The error in approximating $\frac{1}{b}$ by the integer $c_i$ is:
\begin{align*}
\left|c_i - \frac{1}{b}\right|_p = \left|\frac{bc_i - 1}{b}\right|_p = \frac{|bc_i - 1|_p}{|b|_p}.
\end{align*}
We have $|b|_p = 1$ since $\gcd(b,p) = 1$. And $bc_i - 1 = -p^i y_i$, so $|bc_i - 1|_p = |p^i y_i|_p \leq |p^i|_p = p^{-i}$. Therefore $|c_i - \frac{1}{b}|_p \leq p^{-i} \to 0$.
This is the essential mechanism: the $p$-adic metric measures divisibility by $p$, and modular inverses give better and better divisibility as the modulus grows.
[/guided]
[/step]
[step:Lift the density from $\mathbb{Z}_{(p)}$ to $\mathbb{Z}_p$ and conclude $\mathbb{Z}_p \subseteq \overline{\mathbb{Z}}$]
By definition, $\mathbb{Q}_p$ is the completion of $\mathbb{Q}$ with respect to $|\cdot|_p$, so $\mathbb{Q}$ is dense in $\mathbb{Q}_p$. The set $\mathbb{Z}_{(p)} = \{x \in \mathbb{Q} : |x|_p \leq 1\}$ is the intersection $\mathbb{Q} \cap \mathbb{Z}_p$. Since $\mathbb{Q}$ is dense in $\mathbb{Q}_p$ and $\mathbb{Z}_p$ is the closed ball $\{x \in \mathbb{Q}_p : |x|_p \leq 1\}$, the set $\mathbb{Z}_{(p)}$ is dense in $\mathbb{Z}_p$: for any $x \in \mathbb{Z}_p$ and $\varepsilon > 0$, there exists $q \in \mathbb{Q}$ with $|x - q|_p < \varepsilon$, and then $|q|_p \leq \max(|x|_p, |x - q|_p) \leq \max(1, \varepsilon)$; for $\varepsilon \leq 1$, this gives $q \in \mathbb{Z}_{(p)}$.
From the previous step, $\mathbb{Z}$ is dense in $\mathbb{Z}_{(p)}$. Since the closure of a dense subset of a dense subset is the closure of the innermost set, we have: for any $x \in \mathbb{Z}_p$ and $\varepsilon > 0$, there exists $q \in \mathbb{Z}_{(p)}$ with $|x - q|_p < \varepsilon/2$, and then $z \in \mathbb{Z}$ with $|q - z|_p < \varepsilon/2$, giving $|x - z|_p \leq \max(|x - q|_p, |q - z|_p) < \varepsilon$ (by the strong triangle inequality). Therefore $\mathbb{Z}$ is dense in $\mathbb{Z}_p$, which means $\mathbb{Z}_p \subseteq \overline{\mathbb{Z}}$.
[/step]
[step:Combine both inclusions]
We have shown $\overline{\mathbb{Z}} \subseteq \mathbb{Z}_p$ (since $\mathbb{Z} \subseteq \mathbb{Z}_p$ and $\mathbb{Z}_p$ is closed) and $\mathbb{Z}_p \subseteq \overline{\mathbb{Z}}$ (since $\mathbb{Z}$ is dense in $\mathbb{Z}_p$). Therefore $\mathbb{Z}_p = \overline{\mathbb{Z}}$.
[/step]