Using optocoupler with MOSFET for dimming a LED
power mosfets have significant gate capacitance and your gate drive is significantly unbalanced.500 ohms to charge and 600K to discharge that's about 100:1 no wonder the PWM osn't showing results.

replace R3 with 1K replace R2 with a wire, that will give a stronger disharge drive and should work better.