[proofplan]
We subtract the two holomorphic functions and study the set of points where the difference vanishes on a whole neighbourhood. This set is nonempty and open by the hypothesis and by its definition. The main point is to prove it is closed: near any [limit point](/page/Limit%20Point), pass to a connected coordinate ball and apply the local identity theorem for holomorphic functions of several complex variables. Connectedness of $X$ then forces this nonempty clopen set to be all of $X$.
[/proofplan]
[step:Reduce the theorem to local vanishing of one holomorphic function]
Define the [holomorphic function](/page/Holomorphic%20Function) $h:X\to\mathbb{C}$ by
\begin{align*}
h(x)=f(x)-g(x).
\end{align*}
Since addition and subtraction of holomorphic complex-valued functions are holomorphic in local charts, $h$ is holomorphic. The hypothesis $f|_U=g|_U$ says precisely that
\begin{align*}
h(x)=0
\end{align*}
for every $x\in U$.
Define the local vanishing set $Z\subset X$ by
\begin{align*}
Z=\{x\in X:\text{ there exists an open neighbourhood }N_x\subset X\text{ of }x\text{ such that }h|_{N_x}=0\}.
\end{align*}
Because $U$ is nonempty and $h|_U=0$, every point of $U$ belongs to $Z$, so $Z\neq\varnothing$.
[/step]
[step:Show the local vanishing set is open by its definition]
Let $x\in Z$. By definition of $Z$, there exists an open neighbourhood $N_x\subset X$ of $x$ such that $h|_{N_x}=0$. If $y\in N_x$, then the same neighbourhood $N_x$ witnesses that $y\in Z$. Hence $N_x\subset Z$. Therefore $Z$ is open in $X$.
[/step]
[step:Propagate local vanishing across limit points using a connected coordinate ball]
We prove that $Z$ is closed. Let $x\in\overline{Z}$, where the closure is taken in the topology of $X$. Choose a complex coordinate chart $(W,\varphi)$ around $x$, with
\begin{align*}
\varphi:W\to\varphi(W)\subset\mathbb{C}^n
\end{align*}
a homeomorphism onto an open subset of $\mathbb{C}^n$, where $n$ is the complex dimension of $X$. Since $\varphi(W)$ is open and contains $\varphi(x)$, choose $r>0$ such that the open Euclidean ball
\begin{align*}
B(\varphi(x),r):=\{z\in\mathbb{C}^n:|z-\varphi(x)|<r\}
\end{align*}
is contained in $\varphi(W)$. Define the connected coordinate neighbourhood $V\subset X$ by
\begin{align*}
V=\varphi^{-1}(B(\varphi(x),r)).
\end{align*}
The set $V$ is open in $X$, contains $x$, and is connected because $B(\varphi(x),r)$ is connected and $\varphi|_V:V\to B(\varphi(x),r)$ is a homeomorphism.
Since $x\in\overline{Z}$ and $V$ is an open neighbourhood of $x$, the intersection $V\cap Z$ is nonempty. Choose $y\in V\cap Z$. By definition of $Z$, there is an open neighbourhood $N_y\subset X$ of $y$ such that $h|_{N_y}=0$. Then $N_y\cap V$ is a nonempty open subset of $V$ on which $h$ vanishes.
Define the coordinate representative $H:B(\varphi(x),r)\to\mathbb{C}$ by
\begin{align*}
H(z)=h(\varphi^{-1}(z)).
\end{align*}
Because $h$ is holomorphic on the [complex manifold](/page/Complex%20Manifold) $X$ and $(W,\varphi)$ is a holomorphic chart, $H$ is holomorphic on the connected domain $B(\varphi(x),r)\subset\mathbb{C}^n$. Moreover $H$ vanishes on the nonempty [open set](/page/Open%20Set) $\varphi(N_y\cap V)\subset B(\varphi(x),r)$. By the Identity Theorem for Holomorphic Functions of Several Complex Variables, $H=0$ on $B(\varphi(x),r)$. Therefore $h=0$ on $V$, so $x\in Z$. Thus $\overline{Z}\subset Z$, and $Z$ is closed.
[guided]
Recall that $h:X\to\mathbb{C}$ is the holomorphic function $h=f-g$, and that $Z\subset X$ is the set of points at which $h$ vanishes on some open neighbourhood. We need to prove that a limit point of $Z$ also belongs to $Z$. The definition of $Z$ is stronger than pointwise vanishing: a point belongs to $Z$ only when $h$ vanishes on some whole neighbourhood of that point. Thus, starting with $x\in\overline{Z}$, we must produce an open neighbourhood of $x$ on which $h$ vanishes.
Choose a complex coordinate chart $(W,\varphi)$ around $x$, where
\begin{align*}
\varphi:W\to\varphi(W)\subset\mathbb{C}^n
\end{align*}
is a homeomorphism onto an open subset of $\mathbb{C}^n$. We want the coordinate domain to be connected, because the local identity theorem for holomorphic functions propagates vanishing across connected domains. Since $\varphi(W)$ is open and contains $\varphi(x)$, there exists $r>0$ such that the open Euclidean ball
\begin{align*}
B(\varphi(x),r):=\{z\in\mathbb{C}^n:|z-\varphi(x)|<r\}
\end{align*}
is contained in $\varphi(W)$. Define
\begin{align*}
V=\varphi^{-1}(B(\varphi(x),r)).
\end{align*}
Then $V$ is an open neighbourhood of $x$ in $X$. It is connected because the ball $B(\varphi(x),r)$ is connected and $\varphi|_V:V\to B(\varphi(x),r)$ is a homeomorphism.
Since $x\in\overline{Z}$, every open neighbourhood of $x$ meets $Z$. Applying this to the open neighbourhood $V$, choose a point $y\in V\cap Z$. By the definition of $Z$, there exists an open neighbourhood $N_y\subset X$ of $y$ such that $h|_{N_y}=0$. Hence $h$ vanishes on the nonempty open subset $N_y\cap V$ of $V$.
Now translate this statement into coordinates. Define the coordinate representative $H:B(\varphi(x),r)\to\mathbb{C}$ by
\begin{align*}
H(z)=h(\varphi^{-1}(z)).
\end{align*}
Because $h:X\to\mathbb{C}$ is holomorphic and $(W,\varphi)$ is a holomorphic coordinate chart, the coordinate representative $H$ is holomorphic on $B(\varphi(x),r)$. The set $B(\varphi(x),r)$ is connected, and $H$ vanishes on the nonempty open subset $\varphi(N_y\cap V)$. Therefore the Identity Theorem for Holomorphic Functions of Several Complex Variables applies and gives
\begin{align*}
H(z)=0
\end{align*}
for every $z\in B(\varphi(x),r)$.
Returning from coordinates, this means $h=0$ on $V$. Since $V$ is an open neighbourhood of $x$, the definition of $Z$ gives $x\in Z$. We have shown every point of $\overline{Z}$ lies in $Z$, so $Z$ is closed.
[/guided]
[/step]
[step:Use connectedness to force the local vanishing set to be all of $X$]
We have shown that $Z$ is nonempty, open, and closed in $X$. If $Z\neq X$, then $X\setminus Z$ is also nonempty and open, and the two disjoint nonempty open sets $Z$ and $X\setminus Z$ separate $X$. This contradicts the connectedness of $X$. Hence $Z=X$.
For every $x\in X$, since $x\in Z$, there exists an open neighbourhood $N_x\subset X$ of $x$ such that $h|_{N_x}=0$. In particular, $h(x)=0$. Thus $h=0$ on $X$, which means
\begin{align*}
f(x)=g(x)
\end{align*}
for every $x\in X$. Therefore $f=g$ on $X$.
[/step]