psc91
With a typical brushed DC motor (dc motor with two wires), it requires a certain voltage and current to run. The arduino can indeed supply 5 volts, but it can only supply a miniscule amount of current from its output pins, which is typically not enough for DC motors, including your fan's motor (as mentioned by nickn4).
I reckon all you need is one transistor. Here is a bit of an explanation in case you are not familiar with them:
Transistors can be thought of in this application as an electronic on-off switch.
Your typical switch has two terminals and physical button itself. Connect one terminal to the battery and one terminal a lightbulb, then if you flick the button up the lightbulb will turn on, and if you flick the button down, the lightbulb will turn off.
Transistors have 3 terminals, two of them have the same function as the 2 terminals on electric switch, but the third terminal is replaces the physical button of a normal switch. If you output a high voltage to this terminal, then the transistor will turn the lightbulb on. If you output a low voltage, the transistor will turn the lightbulb off.
Additionally, transistors are sensitive to a variable voltage. if you send 50% of max voltage to the third terminal (the one that replaces a button), the lightbulb will be 50% bright. With motors, this will allow you to control the motor's speed.
The reason you need transistors is because the third 'triggering' terminal requires a miniscule amount of current. That way your arduino output is only require to trigger the motor, not to power it, and will then be strong enough.
To complete nickn4's post, the arduino can indeed control the fan speed with PWM. Connect the PWM pin to a transistor, and you can fully control the speed of the fan. PWM is essentially an analogue output, where it can output a specific voltage between 0V and 5V (like 1.5V), instead of just 0V or 5V (On or Off). As I mentioned earlier, by varying the voltage, you can vary the amount of current the transistor allows to flow through, and therefore control the speed of the motor.
TO BE EXACT, arduino's cant actually output anything aside from 0V or 5V, and PWM actually works by rapidly turning on/off a 5V signal, and since it happens so quickly, most sensors will read an analogue voltage. Imagine playing flappy bird, even though you have no joystick control, you can control the height of the bird by rapidly tapping the screen. If you mash the screen the bird will fly high, but depending on how fast you tap it, you will be able to control how high the bird flies. Similarly, the arduino cannot output a specific height for the bird to fly at, but it still can indirectly control that height by tapping the screen faster/slower.
Hope you find this useful!
StefL