Mosfet current control with PWM
the source of your MOS-FET needs to be connected to the reference of the 5V supply of the arduino, your schematic does not show this connection.

without it the gate voltage is floating so it will be very unlikely to ensure turn off while floating.

You always apply voltage as a differential so a single connection, the gate needs the output, but also the source needs to be connected to the 5V reference.

Sadly, this is not a good design you do not want the reference of the Arduino to have an inductor leading to ground right after and not be connected to ground.

I have a couple ideas from the top of my head.

Re-design the circuit so the source goes to ground and you can connect the Arduino reference to source also

use a DC-DC converter to isolate the arduino from your 5V power line then there is no issue with connecting the source to the 5V reference.