If you can factor the joint density into a product that is a function of x times a function of y, then $X$ and $Y$ are independent and their marginal densities are a constant multiple of the two functions in the product. That is, if
$$f_{X, Y}(x, y) = g(x) h(y)$$
for some functions $g(x)$ and $h(y)$, then $X$ and $Y$ are independent and
$$f_X(x) = c g(x)$$
and
$$f_Y(y) = \frac{1}{c} h(y),$$
for some constant $c$. In fact, this statement is an if and only if. And, in your specific problem, you can write
$$f_{X, Y}(x, y) = (\lambda e^{-\lambda x}) \cdot (\lambda e^{-\lambda y}) = g(x) h(y)$$
so $X$ and $Y$ are independent. That doesn't tell us what $f_X(x)$ or $f_Y(y)$ are except they are constant multiples of $g(x)$ and $h(y)$, respectively. I broke it up like I did to be symmetrical and because each function would be the pdf of an exponential.
In this case, you can actually figure out the marginal densities with a bit of thought. Since we know an exponential has density $\lambda e^{-\lambda x}$ we know that integrates to 1. So, if we took away the $\lambda$, i.e., $e^{-\lambda x}$, it would integrate to $\frac{1}{\lambda}$. Or, if we had any other constant $c$ in front, $c e^{-\lambda x}$, it would integrate to $\frac{c}{\lambda}$. So, we must have $c = \lambda$ in front to ensure the PDF integrates to 1. So, the $g(x)$ and $h(y)$ I picked above must in fact be the marginal PDFs for $X$ and $Y$. Thus, if you are very familiar with some of the major densities, you can figure these out without ever integrating to get the marginal densities. It's just factoring.