let $f : X \to X $ be an isometry $d((f(x)),f(y)) = d(x,y)$ for all $x,y \in X$. It could easily be shown that $f$ is continuous and injective. Now if we let $X$ to be compact, need to show that it is surjective in this case. The proof proceeds as following:
Suppose $f(X) \neq X$. Then there exists a $a \in X$ such that $a \not \in f(X)$. The function $f$ is continuous, and since $X$ is compact so is $f(X)$. Notice that $f(X)$ is compact in $X$, being hausdorff $f(X)$ is closed, making $X - f(X)$ open. Then for this $a$, I can find a $\epsilon$ neighbourhood such that $B(a,\epsilon) \subset X - f(X)$.
This is ofc, not the whole proof. However I understood the other part easily, only problem I have is here that why $X$ is hausdorff so that $f(X)$ is closed in $X$. I'm not given that it is Hausdorff or anything.