Need help understanding components

Forgot about D2, which is another part of the reason for R2. D2 is a zener diode, which sets the limit of the voltage the gate sees by conducting any voltage above it's zener rating to ground. Without R2, when the opto is conducting, the zener would be trying to regulate the power supply to ground and either drag the PSU voltage down (for a weak supply), or simply burn the zener out (probably what would happen in your scenario). It also helps prevent transients that could damage the gate.