2222a transistor as a switch

Your Arduino to 2N2222, base connection needs a resistor, try 220R.
Debounce the switch.
Add 100nF capacitors to the input and output of the 7805. (Near the regulators pins.)

Edit: add 1N4007 across the solenoid (cathode to +12V).