Quick answer: fair stroke, 2 points, yellow stays in pocket, green is now the ball on.
If that is all you want/need, stop reading. If your interest is deeper, read on.
Free ball is possibly the least well understood Rule of Snooker, more so I believe than Foul and a Miss. Therefore, I will take this opportunity to pontificate on the subject. The Free Ball rule is simple enough in its most basic form, but there are subtle nuances to it (such as the example) which can easily become confusing. So to make every circumstance of Free Ball absolutely clear, it is easiest to write about it using a sort of a code language.
So from this point on, when referring to any ball on, I will refer to it in one of three possible ways (I will use red for example, but it might be any colour): first is red, meaning an actual red ball. Second is "red", meaning any free ball which is nominated in place of red. And third is RED, meaning the point value scored as a result of the pot of the red(s) and/or "red".
Confused? Hopefully, it will become clear...
So, if red is the ball on and a "red" is nominated, the striker MUST hit the free ball first. If for instance, a red and a possible "red" are very close together, the striker CANNOT nominate the "red" then just shoot in that direction figuring that it doesn't matter which ball is struck first. If the free ball is nominated, then the red is struck first, it is a foul. This is always the case. If you call a free ball, you must make contact with that free ball first as anything else is a foul.
If a "red" is nominated, legally struck first, then the "red" and/or another red fall into a pocket, then all RED points are scored. For instance, free ball, yellow is called as "red", it can be played as a plant into another red which is potted, 1 RED is scored. Perhaps the yellow "red" is potted and another red is also fluked on same stroke, score is 2 (for 2 REDS). However, this is ONLY true for reds, because in the usual course of play, it is possible to pot and score more than one red on a single stroke (three is the most that I have personally ever seen). This is not true with a colour.
On the other hand, if a "colour" is nominated for a free ball, the situation is similar BUT DIFFERENT. Using the OP's example, green is nominated as "yellow", and so must be struck first. There are three possible LEGAL strokes in which a ball or balls may be potted: 1) "yellow" is potted, score 2 (YELLOW), and the green is re-spotted, yellow is still the ball on, 2) "yellow" is planted (or white is cannoned) onto the yellow which is potted (OP's example), score 2 (YELLOW) and the yellow stays in pocket, green is now the ball on, and 3) "yellow" and yellow are both potted, score 2 (because only one YELLOW can possibly be scored in usual course of play), yellow remains in pocket, green is re-spotted and green is now the ball on.
1) above is how things normally happen. People tend to get confused when 2) or 3) happen.
Think of it this way....any colour may be legally potted one time and one time only (stays in pocket) in the final colour sequence (yellow-green-brown-blue-pink-black) but a "colour" can be potted and re-spotted any number of times when used as a free ball. Anytime a colour is legally potted in the final sequence, it stays off the table, whether it was potted directly, potted as a plant from a free ball, or potted in conjunction with the free ball, the only important factor being that it was potted in the course of a fair (non-foul) stroke.
Circumstance 3) above is most confusing because common sense says that if a red and a "red" score two points, then a yellow and a "yellow" should score four points. Right? But the difference is that in the usual course of play, it is possible to score multiple reds in a single stroke, but it is not possible to score multiple yellows in a single stroke, therefore multiple YELLOWS are not allowed even in the case of a free ball. I have also known a person or two to incorrectly believe that it is a foul to pot both the free ball and the natural ball (or, as the OP may be suggesting, to pot the natural ball after playing at the free ball). In the case of potting both, the free ball just acts as a dummy place holder...not a foul, but doesn't score any points either.
If you have made it this far, and if the above information makes sense to you, Congratulations! You are in the top one percent of the class! My referee's training instructor told me that it was not uncommon even for professional players to misinterpret this rule when faced with such a situation.