OP notrockstar knows the solution for the case when the random variables are independent but presumably cannot use it since a solution without the
independence assumption is being sought. Perhaps the OP has posted only
a simplified version of the question, and what has been left out makes
a solution possible. For example, if $X_1$ and $X_2$ are given to be the
times of the $k$-th and $(k+\ell)$-th arrivals in a Poisson process of intensity
(arrival rate) $\lambda$, then these are Gamma random variables with
order parameters $k$ and $k+\ell$ respectively. Furthermore,
conditioned on $X_1 = x_1$, $X_2$ is a displaced Gamma random variable
with order parameter $\ell$, that is, $X_2 = x_1 + Y$ where
$Y$ is a Gamma random variable with order parameter $\ell$. Thus,
$$\begin{align*}
f_{X_1,X_2}(x_1,x_2) &= f_{X_2|X_1}(x_2|x_1)f_{X_1}(x_1)\\
&= \begin{cases}
f_Y(x_2-x_1)f_{X_1}(x_1), & 0 < x_1 < x_2 < \infty,\\
0, & \text{otherwise.}
\end{cases}
\end{align*}$$
In view of the additional information provided by the OP that what is really wanted is the joint distribution of $Y_1 = X_1 + X_2$ and $Y_2 = \frac{X_1}{X_1+X_2}$, maybe the problem is intended as drill in transformation of
variables: can you express the joint density $f_{Y_1,Y_2}(y_1,y_2)$ in
terms of the joint density $f_{X_1,X_2}(\cdot,\cdot)$ as
$J(y_1,y_2)f_{X_1,X_2}(g_1(y_1,y_), g_2(y_1, y_2))$ with the Gamma
functions thrown in as distractions, or merely as hints that
$X_1, X_2 \in (0, \infty)$ to see if the students can deduce
that $Y_2 \in (0,1)$.
This problem is readily solvable since it is easy to invert
the transformation, find the Jacobian etc. At the end, one
could say something like "If $X_1$, $X_2$ are assumed to be
independent (this is not stated in the problem given) random
variables with Gamma distributions, then
the joint density $f_{X_1,X_2}(\cdot,\cdot)$ factors into the product
of the marginal densities, and in this case,
$f_{Y_1,Y_2}(y_1,y_2)$ equals "$\cdots$" possibly adding that
$Y_1$ and $Y_2$ are obviously independent if they are (I don't
believe they are but am willing to abide a proof that they are),
or giving their marginal pdfs too etc.
In summary, $f_{Y_1,Y_2}(y_1,y_2)$ can be stated in
terms of the joint density $f_{X_1,X_2}(\cdot,\cdot)$
without knowing the exact form of $f_{X_1,X_2}$ or the
marginal densities of $X_1$ and $X_2$. The assumption that
$X_1$, $X_2$ are independent can be used at the very end
to say explicitly what $f_{Y_1,Y_2}(y_1,y_2)$ is; the
Gammaity or independence of $X_1$ and $X_2$ is not needed
or used at all in the earlier work, and indeed serves
merely to clutter up the calculations without shedding
much light on the matter.