Here is an open-collector calculator 101
To drive a load to ground with an NPN transistor you need to pick the transistor on the following data
The Collector to Emitter voltage must be higher than your max voltage. In your case this is 5 V. So a 20V or 40V is more than fine. Just more than 5 V with some good margin.
The max collector current must be larger than your load current. Again you need a good margin.
The Max Power Dissipation must be larger than the power that will be burned in the transistor. This you need to calculate using the formular Power = Voltage x Current. The difficult part is the voltage. The voltage is the voltage over the collector to emitter. In the ideal world this is 0 assuming that the transistor is saturated. But in practical life expect 0.05 to 1 V. If find one that has max 0.2 V you should be good.
Now I said saturation. What is that? A transistor is saturated when the basis current is larger than the collector current divided by the DC current gain (hFE or beta). Here you need to look at the MINIMUM value for the hFE. For 2N2222A this would be something like 100 at a 200 mA collector current.
The voltage drop on base to emitter is always 0.6 to 0.7 V for silicon.
The port that drives the basis is from an ESP device so this is 3.3V when the port is high.
So you take your load which is 200 mA max. And then you divide the 200 mA by 100 and that is 2 mA.
So we need a resistor that is small enough to limit the current to 2.67 mA. The voltage over the resistor is the 3.3V - 0.7 V = 2.6 V. And then we use ohms law to calculate the resistor. R = V / I. So 2.6V / 2mA = 1.3 kohms.
We have to make sure the transistor is always in saturation. So we should actually make the basis current even larger. The more basis current the lower the saturation voltage. The max output from an ESP is something like 12 mA. But if we keep some margin. Let us say we feed 6 mA. That is 3 times more than we calculated for saturation.
Then the resistor then becomes (3.3-0.7)/0.006 = 433 ohms. So maybe 470 ohms would be a good value.
Then we can calculate forward and check everything is OK. At 470 ohms the basis current = output from ESP = 5.5 mA. The transistor collector current can then driver 5.5mA x 100 = 550 mA which is double the load so the transistor should saturate.
But what about the power in the transistor. If the saturation voltage is 1 V and the load is 200 mA, the power is 0.2 W. That little transistor will get warm. And the load will not get the full 5 V.
So not a good choice of device to begin with.
You need a device with a larger minium hFE and lower saturation voltage.
OR
Don’t use a bipolar transisistor in the first place.
A popular one is IRLZ44N. It turns on at a gate voltage around 2V so good for 3.3V logic. Its on resistance is 0.002 ohms so it will be stone cold at a 200 mA load. The ESP 8266 does not need to drive any current so it will be less warm.
A smaller one would be BS170 good for a few hundred mAs. Or BSS138.
The different types mainly differ on their speed but for DC you do not need to care about anything else than the turn on gate voltage and the current rating.
Logic level N channel transistors is really what you want to buy a little bag of. They are much easier to deal with. You do not need a resistor between the ESP output and the gate but it is normal to put one anyway to limit the damage if something fails. So 1 kohms is a good value. And to make sure the FET is off when the ESP is booting you also put 10 kohms from gate to ground.