This is the schematic for the project. I'm using an IRF520 transistor (http://www.futurlec.com/Transistors/IRF520.shtml) which goes from left to right Gate->Drain->Source. So the problem is that when gate is connected to a pin on the arduino the transistor will always be open regardless of what that pins state is but if I pull it out the transistor closes. Any help would be appreciated. imgur.com/a/dYliz EDIT: Added Schematic link
Based on the newest schematic, Your pull-down resistor is too strong for the Arduino's output to overcome. A 220Ω resistor pretty much guarantees issues. Try bumping it to 2.2kΩ or 22kΩ.
See the two answers in Calculating the pulldown resistance for a given MOSFET's gate for more info, one math heavy, the other one more plain terms.