[proofplan]
We identify $\operatorname{End}_{\mathcal{C}}(X)$ with the hom-set $\operatorname{Hom}_{\mathcal{C}}(X,X)$. Closure follows because composing two morphisms $X \to X$ again gives a morphism $X \to X$. The associativity and identity axioms for a monoid are exactly the associativity and unit axioms for composition in the category $\mathcal{C}$, restricted to endomorphisms of the single object $X$.
[/proofplan]
[step:Unpack endomorphisms as morphisms from $X$ to itself]
By definition,
\begin{align*}
\operatorname{End}_{\mathcal{C}}(X) = \operatorname{Hom}_{\mathcal{C}}(X,X).
\end{align*}
Thus an element $f \in \operatorname{End}_{\mathcal{C}}(X)$ is precisely a morphism
\begin{align*}
f: X \to X
\end{align*}
in the category $\mathcal{C}$.
[guided]
The notation $\operatorname{End}_{\mathcal{C}}(X)$ means the collection of all endomorphisms of $X$ in the category $\mathcal{C}$. An endomorphism is a morphism whose domain and codomain are the same object. Therefore
\begin{align*}
\operatorname{End}_{\mathcal{C}}(X) = \operatorname{Hom}_{\mathcal{C}}(X,X).
\end{align*}
So whenever we write $f \in \operatorname{End}_{\mathcal{C}}(X)$, we are saying exactly that $f$ is a morphism
\begin{align*}
f: X \to X.
\end{align*}
This translation is the whole reason the categorical composition law can be applied without changing objects: every morphism involved both starts and ends at $X$.
[/guided]
[/step]
[step:Compose two endomorphisms to obtain another endomorphism]
Let $f,g \in \operatorname{End}_{\mathcal{C}}(X)$. Then
\begin{align*}
g: X \to X
\end{align*}
and
\begin{align*}
f: X \to X.
\end{align*}
Since the codomain of $g$ is $X$ and the domain of $f$ is $X$, categorical composition is defined, and
\begin{align*}
f \circ g: X \to X.
\end{align*}
Hence $f \circ g \in \operatorname{Hom}_{\mathcal{C}}(X,X)$, so
\begin{align*}
f \circ g \in \operatorname{End}_{\mathcal{C}}(X).
\end{align*}
Thus $\operatorname{End}_{\mathcal{C}}(X)$ is closed under composition.
[/step]
[step:Restrict categorical associativity to endomorphisms of $X$]
Let $f,g,h \in \operatorname{End}_{\mathcal{C}}(X)$. Then $f$, $g$, and $h$ are all morphisms from $X$ to $X$, so both composites
\begin{align*}
(f \circ g) \circ h
\end{align*}
and
\begin{align*}
f \circ (g \circ h)
\end{align*}
are defined as morphisms $X \to X$. By the associativity axiom for composition in the category $\mathcal{C}$,
\begin{align*}
(f \circ g) \circ h = f \circ (g \circ h).
\end{align*}
Therefore composition is associative on $\operatorname{End}_{\mathcal{C}}(X)$.
[/step]
[step:Use the identity morphism of $X$ as the monoid identity]
The category $\mathcal{C}$ contains an identity morphism
\begin{align*}
\operatorname{id}_X: X \to X
\end{align*}
for the object $X$. Hence
\begin{align*}
\operatorname{id}_X \in \operatorname{End}_{\mathcal{C}}(X).
\end{align*}
Let $f \in \operatorname{End}_{\mathcal{C}}(X)$. Since $f: X \to X$, the identity laws in the category $\mathcal{C}$ give
\begin{align*}
\operatorname{id}_X \circ f = f
\end{align*}
and
\begin{align*}
f \circ \operatorname{id}_X = f.
\end{align*}
Thus $\operatorname{id}_X$ is a two-sided identity for composition on $\operatorname{End}_{\mathcal{C}}(X)$.
[/step]
[step:Verify the monoid axioms]
The operation
\begin{align*}
\circ: \operatorname{End}_{\mathcal{C}}(X) \times \operatorname{End}_{\mathcal{C}}(X) \to \operatorname{End}_{\mathcal{C}}(X)
\end{align*}
is well-defined by closure under composition. It is associative by categorical associativity, and it has the two-sided identity element $\operatorname{id}_X$ by the categorical identity laws. Therefore
\begin{align*}
(\operatorname{End}_{\mathcal{C}}(X), \circ, \operatorname{id}_X)
\end{align*}
is a monoid. This proves the theorem.
[/step]