You fried your little 2N2222A transistor because you exceeded it's maximum current ratings! If you take a peek into the datasheet, it shows the absolute maximum current.

Okay so the datasheet claims 800mA, but that's assuming you are able to keep the device cooled to T(A), which you can see is 25C (room temp). That's a whole another story though. In general, with a 2n2222A, you don't want to switch currents more than 500mA.
Let's find you a better component to switch your motor on and off (or varying speeds!). A quick search on Adafruit reveals the IRLB8721. Behold the N-Channel MOSFET! If we take a peek inside its datasheet, we can see that it will switch a max current of 62A. This is also assuming we can keep the chip cooled to T(A) = 25C, and a few other things as well. Since you are only needing to switch 3A, you'll be well within its ratings and won't have to worry about your MOSFET.

You mentioned you would like to switch the motor with 3.3V from your Node MCU. Let's check the datasheet again:

You can see V(GSth) is rated for a gate voltage of 1.35 to 2.35V. So wouldn't your NodeMCU's 3.3V be too high? If you check in the previous image, one box above the red encircled box reveals that the absolute maximum gate voltage can be +/-20V, so put a resistor between your Node MCU's pin and the gate of the MOSFET. What value? Well selecting a properly valued resistor for a FET can quite difficult to calculate, so most of the time for projects like these we tend to use a 1K resistor, or a 2K2 resistor if you have some handy.
You might be wondering why I chose a MOSFET that can switch so much more current then what your project requires. These FETs are just easy to come by, and will provide a very nice safety cushion for your system. As Brian pointed out, the motor could have a stall current as high as 15A, so this FET will easily handle job.
How do you wire it all? A quick search for "N-Channel MOSFET used as switch" on Google turns up this. Photo taken from: 
I know you don't have an Arduino but the principle is the same. Pay careful attention do the Gate, Drain, and Source of the MOSFET. The diode can be like a 1N4007 (pretty standard).
AddOhms on YT has an excellent video on how to use MOSFETs, I highly suggest you watch the video!
You said you were new to the field of electronics- welcome! It's a lot of fun. I tried to keep this answer on the simpler side yet informative. You should be wired up in no time.
A popular logic-level FET is the IRLZ44N.
Good luck with the project!