5V Output Pin

I Have a DC 5V 0.35A Fan and I would like to power it.

I plug it into the 5V pin and it works, but when I control it using digitalWrite() or analogWrite(255) it does one jolt then it doesn't spin but it emits a quiet but high pitched noise... Could anyone help?

Consider the difference between the 0.04A absolute maximum rating of an Arduino pin (0.02A is a sensible
maximum current to work with), and your fan's 0.35A rating. Consider that the Arduino microcontroller
chip is at risk of permanent damage if any of the absolute maximum values is exceeded....

The digital pins of an Arduino are logic signals, they cannot drive significant amounts of power, and can
damage themselves if overloaded in this way.

The way to control power like this from a logic signal is by boosting the signal with a MOSFET or BJT that
is rated for 0.35A. Try googling terms "low side switch", mosfet, arduino, 2N2222

Ok thank you, I read somewhere that the max is 0.3A.

Not per pin, that's a huge amount of current for logic.

I think you might be confusing with the total current for the whole microcontroller.