$X$ is the count of green objects, $Y$ is the count of balls.
Then the margarine probabilities are:$$\Pr (X=x) = \dfrac{\binom 2 x ~ \binom 4 {2-x}}{\binom 6 2}~\mathbf 1_{x\in\{0,1,2\}}\\ \Pr(Y=y) = \dfrac{\binom 3 y ~ \binom 3 {2-y}}{\binom 6 2}~\mathbf 1_{y\in\{0,1,2\}}$$
However, you cannot simply multiply these together to obtain the joint probability, since the random variables are not independent. There is a green ball which might be picked. It's existence must be accommodated.
Let $Z\in\{0,1\}$ be the count of green balls drawn. Use Total Probability partitioned on whether a green ball is drawn or not. Then consider ways to pick from the 1 green ball, 1 green marbles, 2 not-green balls, and 2 not-green marbles.
$$\Pr(X=x, Y=y) = \Pr(Z=0, X=x, Y=y) + \Pr(Z=1, X-Z=x-1, Y-Z=y-1)
\\ =\frac{\binom{1}{0}\binom{1}{?}\binom{2}{?}\binom{2}{?}}{\binom 6 2}\mathbf 1_{x\in\{0,1\}, y\in\{0,1,2\}, x+y\leq 2}+\frac{\binom{1}{1}\binom{1}{?}\binom{2}{?}\binom{2}{?}}{\binom 6 2}\mathbf 1_{x\in\{1,2\},y\in\{1,2\}, x+y\leq 3}$$
I would note that there are three paths to this result
--++
-+-+
+--+
each with a probability of $0.8^2\cdot0.2^2=0.0256$. Thus, the total probability would be $3\cdot0.0256=0.0768$
This is a slightly different approach getting to the same result.
Best Answer
You have to look at the different combinations.
For X=1, you open one box and the prize is there. So P(X=1)=3/5.
For X=2, you open one box and there is no prize, you open a second and there is a prize. Then P(X=2)=(2/5)(3/4).
For X=3, you open the first two and find no prize but find a prize on the third. We have P(X=3)=(2/5)(1/4)(3/3).
Note that all 3 of these probabilities add up to 1. These make up your PMF.