Arduino with IRL540N not working

The circuit looks OK. maybe try with a led and a resistor instead of your motor. Normally you could dim it with PWM...
Hmm and are 4x AA enough, that is less than 5v, does the mosfet conducts if Vd is more than Vg?