The algorithm mentioned by Qiaochu and Franz is the following.
Let $z\in\mathbb{C}$ be arbitrary with $\Im z>0$.
Replace $z$ by $z+n$, where $n\in\mathbb{Z}$ is uniquely determined by $-1/2<\Re (z+n)\leq 1/2$.
If $|z|<1$, then replace $z$ by $-1/z$ and go back to step 2.
$z$ is in the standard fundamental domain, so stop.
To prove that the algorithm stops in a finite number of steps it suffices to show that it arrives at step 3 only finitely many times. Note that whenever the algorithm arrives at step 3, it increases the imaginary part of $z$, then in step 2 it produces another $z$ with the same imaginary part, but in the strip $-1/2<\Re z\leq 1/2$. Hence it suffices to show the following.
Proposition. Let $z\in\mathbb{C}$ be arbitrary with $\Im z>0$. Then there are only finitely many $\gamma\in\mathrm{SL}_2(\mathbb{Z})$ such that $-1/2<\Re(\gamma z)\leq 1/2$ and $\Im(\gamma z)>\Im z$.
Proof. Let $\gamma=\left(\begin{matrix}a b \\\ c d\end{matrix}\right)\in\mathrm{SL}_2(\mathbb{Z})$ be such that $-1/2<\Re(\gamma z)\leq 1/2$ and $\Im(\gamma z)>\Im z$. Then $\Im(\gamma z)=|cz+d|^{-2}\Im z$, hence $|cz+d|^2<1$. In other words, denoting $z=x+iy$, we have $(cx+d)^2+(cy)^2<1$. This shows that there are finitely many choices for $c$, and for each $c$ there are finitely many choices for $d$. On the other hand, for fixed coprime $c$ and $d$, it is straightforward to see that the matrices $\gamma=\left(\begin{matrix}a b \\\ c d\end{matrix}\right)$$\gamma=\left(\begin{matrix}a b \\\ c d\end{matrix}\right)\in\mathrm{SL}_2(\mathbb{Z})$ form a right coset of the subgroup $\left(\begin{matrix}1 \mathbb{Z} \\\ 0 1\end{matrix}\right)$, hence there is precisely one such $\gamma$ with $-1/2<\Re(\gamma z)\leq 1/2$. Done.