Switch on an esp8266 with a npn transistor (2n2222A)
There are generally three classes of issue here:

First, as pointed out, you've misapplied an NPN device as a high side switch (switching the power), and mixed up the terminals of the transistor, too.  To switch the power rail, you need an actual high side switch, like a PNP transistor or better yet a PFET.  Or, if you must use a NPN or N-channel device, then you need to create a power supply above that being switched, which is probably not worth the bother except when done internally in certain power switch chips.
You could try to switch the ground instead, but this quickly gets ugly when you have communication between the switched device and something else, like your ATtiny, especially if your ATtiny is running at 5 volts and the ESP at 3.3
In either case, most parts, and the ESP8266 in particular have a hard requirement that I/O signals may never be outside the range of the power rails by more than a diode drop.  The practical meaning of this is that if you turn off the supply rail of the ESP8266, you must also take the serial lines sending to it low, and replace any pull-up of the receiving line with a pull-down.

Generally speaking there are two worthwhile paths you could pursue:

The first would be to drop the ATtiny and implement the entire project in the ESP8266; granted, this chip does not have as flexible low-power modes, and you'd probably need to find a regulator with a lower quiescent current than whatever is on your current board.
The second would be to get a proper high side switch for the power rail (either a PFET or a dedicate chip) and then wire up something like the classic NFET pass gate level translator to handle voltage translate between the ATtiny and the ESP8266, because that topology of level shifter can also properly handle having the lower voltage side powered down provided that you use the switched 3v3 supply for the shifter as well as the ESP8266.  Even if your ATtiny is also running at 3v3 and not 5v, using this &quot;level shifter&quot; can solve the need to never drive a signal to a powered-down ESP; alternately you can carefully control the ATtiny GPIOs as the time you power down the ESP.

Another option to using a high-side switch is to find a 3v3 regulator to feed the ESP8266 which has an enable input, and drive that.