L298N Motor Driver and DC Motors Not Spinning

9 V batteries are for smoke alarms and are totally unsuitable for motors. You should use a DC power brick capable of supplying 9-12V at 1 or more Amperes instead.

Note that the ancient L298 driver is extremely inefficient, very limited in current handling capability and wastes a large amount of power as heat. You are much better off with a modern motor driver like this one.

Note that the motor driver you choose must be able to handle the stall current of the motor. Either find that on the manufacturer's web page or product data sheet for your motor, or measure the winding resistance with a multimeter. The stall current is the motor voltage divided by the winding resistance (I = V/R).

Finally, did you connect the motor driver ground and the Arduino ground?