By separation of variables, we get $u(x,y) = X(x) Y(y)$. Plugging this in $ u_{xx} +u_{yy}=0$ we get
$$\frac{X_{xx}}{X} +\frac{Y_{yy}}{Y}=0 \implies \\ \begin{align}&\frac{X_{xx}}{X}=-\lambda,\label{5-4}\\ &\frac{Y_{yy}}{Y}=\lambda \label{5-5} \end{align}$$ where $\lambda \in R$.
From the boundary conditions given, we must have
$$\begin{align}&X(0) = 0\\
&X(\pi) = 0\end{align}$$ in order to have a nontrivial solution for u(x,y).
Equations (2)-(4) are the associated eigenvalue problem.
We know $$X(x) = A \sin(\sqrt\lambda x)+B\cos(\sqrt\lambda x)$$ but we rule out the cosine term because of the first boundary condition on x ( equation 3). Equation 4 implies $$X(\pi) = A\sin(\sqrt\lambda \pi)= 0 \implies \sqrt\lambda \pi = n \pi, n \in N \implies \lambda = n^2 \implies X(x) = A sin(nx)$$ where $\sin(nx)$ are the X eigenfunctions and $-n^2$ is the eigenvalue.
From equation (2), we get $$Y(y) = C e^{\sqrt\lambda y} +De^{-\sqrt\lambda y} $$ but we rule out $C e^{\sqrt\lambda y}$ because this reaches infinity as y approaches infinity. We are left with $$Y(y)=De^{-n y}$$ where $e^{-ny}$ are the y eigenfunctions and $n^2$ is the eigenvalue.
So $$u(x,y) = X(x) Y(y) = \sum_{n = 1}^{\infty} C_n sin(nx) e^{-n y}$$
The boundary condition $$u_y(x,0)=\cos(x) \implies cos(x) =\sum_{n = 1}^{\infty} -n C_n sin(nx) $$ This is a sine fourier series with L = $\pi$, we call $A_n = -n C_n$, and solve for $A_n$:
$$A_n=\frac{2}{\pi} \int_0^{\pi} \cos(x) \sin(nx) dx=\frac{2}{2 \pi} \int_0^{\pi} \Bigl(\sin(n-1)x + \sin(n+1)x \Bigr)\;dx \tag{$\checkmark$}\\ \\ = \frac{-1}{\pi} \left.\frac{\cos(n-1)x}{n-1} \right|_{0}^{\pi} + \left.\frac{\cos(n+1)x)}{n+1} \right|_{0}^{\pi} \implies$$
$A_n = 0$ n is odd
$A_n = \frac{4n}{\pi (n^2-1)}$ n is even
So
$C_n = 0$ n is odd
$C_n=-\frac{4}{\pi(n^2-1)}$ n is even
So $$ u(x,y) = \sum_{n = 1, \;n \;even}^{\infty} -\frac{4}{\pi (n^2-1)} \sin(nx) e^{-n y} \;for \;y>0, 0<x<\pi$$ which can be written as
$$u(x,y) = \sum_{m = 1}^{\infty} -\frac{4}{\pi \Bigl((2m)^2-1 \Bigr)} \sin(2mx) e^{-2m y}, \;\; for \;y>0, 0<x<\pi$$
Edit: my final answer has remained the same, except it's written in a different form (I'm not sure what error I've made after Prof. Ivrii's checkmark, perhaps someone can point it out). I've also formatted the latex a bit differently