I am working on a project to control a Solenoid (12 V/DC 12.96 W) with ESP32. I have attached circuit design as it is in picture. I have couple of questions:
Would this circuit work properly?
You have a solenoid needing 12V and over 1A. You are trying to power it from the ESP's 5V pin using a transistor rated for 0.6A.
So no, clearly isn't going to work well.
I'd strongly suggest use a separate supply for the microcontroller and the solenoid - heavy current inductive
loads are not friendly to logic chips.
A logic-level MOSFET is needed, the IRLB8743 you suggest will be fine.
Remember to decouple the 12V supply near the MOSFET. A 10--100uF electrolytic or so would be a plausible
value. This will reduce noise spikes significantly - together with the free-wheel diode.
[ BTW the high 1k base resistor in your circuit would have limited the 2N2222 to about 150mA
loads anyway - compute base current as 5 to 10% of collector current for a BJT used for
switching ]