1. It would be happy if I could swim well.

2. It would be sad if I had to go back to Mexico.
3. It would be good if I would fly to you.
4. It could be possible if I would open the door.
-----------------------------------------------------------
Are the sentences all in the subjunctive mood?
Are they all grammatical? What is 'It' in each sentence? What does 'It' refer to?

1 is incorrect.

2 is fine.
3 is fine.
4 is incorrect. The wording "could be possible" is redundant: "could" and "possible" mean the same thing. One corrected version is this: I could open the door at any time.