How to use a 2n2222 transistor to pull a pin to ground?
Three problems:

Transistor base current

You are murdering the transistor base. The connection between the base and emitter can be treated much like a diode. When you connect 5 V directly to it, you essentially short-circuit the CPU output pin and a huge amount of current will flow.

In your case it will be limited by the attiny's output current limit, which is only supposed to be used in "emergencies" like this. The circuit will still draw a lot of current through the CPU power supply pin, likely lower it intermittently to a voltage that is too low to function or trigger the brown out detection that reset the CPU.

All of this can be solved with a simple resistor:







simulate this circuit &ndash; Schematic created using CircuitLab

This limits the current to about 0.5 mA, which should be enough to drive your transistor in this case. Decrease it to something like 4.7k or 2k if it doesn't work, but it should.

CPU resetting

You may have too little decoupling capacitance on the CPU voltage input. Make sure there's at least 1 µF of capacitance between GND and VCC near the CPU VCC input pin, and this kinds of CPU resets should be less common.

Tachometer pull-up

You may need a 10k pull-up from the tachometer input to the fan +12 V supply. Right now you are measuring around 2.5 volts which suggests that it is may be floating. I'm not sure if it is necessary in this case, but try that if you can't get this to work. I'm getting some conflicting information when searching for details about this input, a comment by Spehro Pefhany suggests that this may even be harmful, and I agree. The pull-up should not be necessary.