Given $X$ and $Y$ independent random variables with a standard normal distribution, I've been asked to calculate thee distribution of $Z=\arctan(X/Y)$. For that I thought about calculating the cumulative distribution function of $Z$ and then take its derivative. So $P(Z \leq t)$ would be:
$$ \iint_{R}^{ } \frac{1}{2\pi } e^{\frac{-(x^{2}+y^{2})}{2}} $$
where $R=\{(x,y) \in \Bbb R : \arctan(x/y) \leq t)\}$
Then I thought about solving the integral by using polar coordinates, but I'm not sure what the boundaries for $r$ and $\theta$ should be.
You can use a very standard approach, as follows.
First perform a change of variables $$ \begin{cases} U = \arctan\left(\frac{X}{Y}\right)\\ V = X. \end{cases} $$ If you invert the relationships, they become $$ \begin{cases} X = V\\ Y = V\cot U. \end{cases} $$
The Jacobian of this transformation is $$J = \left| \begin{array}{cc} 0 & 1\\ -\frac{V}{\sin^2 U} & \cot U \end{array} \right| = \frac{V}{\sin^2 U}.$$
The joint distribution of $(U,V)$ is
$$f_{U,V}(u,v) = f_{X,Y}(v,v\cot u) |J|,$$ limited to the correct domain, which we can find by considering the codomain of the functions involved in the original change of variables. In our case, the domain is $$ D_{U,V}=\left(-\frac{\pi}2; \frac{\pi}2\right) \times \Bbb R.$$
So we have
$$ f_{U,V}(u,v) = \begin{cases} \frac{1}{2\pi} e^{-\frac{v^2+v^2\cot^2 u}2} \cdot \left|\frac{v}{\sin^2 u}\right| &((u,v) \in D_{U,V})\\ 0 & ((u,v) \not\in D_{U,V}), \end{cases} $$ that is, with some simplifications, $$ f_{U,V}(u,v) = \begin{cases} \frac{1}{2\pi} e^{-\frac{v^2}{2\sin^2 u}} \cdot \frac{|v|}{\sin^2 u} &((u,v) \in D_{U,V})\\ 0 & ((u,v) \not\in D_{U,V}). \end{cases} $$ Finally, by integration we obtain the marginal distribution you need.
$$f_U(u)= \begin{cases} \int_{-\infty}^{+\infty} f_{U,V}(u,v) dv & -\frac{\pi}2 \leq u \leq \frac{\pi}2 \\ 0 & \mbox{otherwise}.\end{cases}\tag{1}\label{1}$$
With the change of variables $t = v^2/2\sin^2 u$ the integral becomes \begin{eqnarray} \int_{-\infty}^{+\infty} f_{U,V}(u,v) dv &=& \frac1{2\pi}\left[\int_0^{+\infty}e^{-t}dt-\int_{-\infty}^0 e^{-t}dt\right]=\\ &=&\frac1{\pi} \int_0^{+\infty}e^{-t}dt = \frac1{\pi}. \end{eqnarray}
Using \eqref{1} leads to the conclusion that $U$ has uniform distribution between $-\frac{\pi}2$ and $\frac{\pi}2$.
If, instead, you want to use the approach you mention (in this case it's faster), then consider the inequality
$$U = \arctan\left(\frac{X}{Y}\right) < \alpha.$$
If $0\leq \alpha \leq \frac{\pi}2$, the condition is satisfied by the points $(X,Y)$ in the red shaded region (Figure below).
So in this case, using the symmetry of the original distribution, we get, for the CDF of $U$, \begin{eqnarray} F_U(\alpha) &=& P(U < \alpha) = \frac1{\pi}\int_0^{+\infty}\int_{\pi/2-\alpha}^{\pi} e^{-\frac{\rho^2}2}\rho d\theta d\rho=\\ &=& \left(\frac12+\frac{\alpha}{\pi}\right)\int_0^{+\infty}e^{-\frac{\rho^2}2}\rho d\rho=\\ &=&\left(\frac12+\frac{\alpha}{\pi}\right). \end{eqnarray}
If $-\frac{\pi}2 \leq \alpha \leq 0$, the points $(X,Y)$ that satisfy the relationship are in the blue shaded region below.
This gives again
\begin{eqnarray} F_U(\alpha) &=& P(U < \alpha) = \frac1{\pi}\int_0^{+\infty}\int_{\pi/2-\alpha}^{\pi} e^{-\frac{\rho^2}2}\rho d\theta d\rho=\\ &=&\left(\frac12+\frac{\alpha}{\pi}\right). \end{eqnarray}
In conclusion, $$ F_U(\alpha) = \begin{cases} \left(\frac12+\frac{\alpha}{\pi}\right) & \left(|\alpha| \leq \frac{\pi}2\right)\\ 0 & \mbox{otherwise}, \end{cases} $$ which clearly is a CDF of a uniform distribution between $-\frac{\pi}2$ and $\frac{\pi}2$.