Hey,
I have quite a lot of experience with the ESP32 and ESP8266, particularly with controlling appliances. For your setup, you will need a relay. I just have a few more questions:
What is voltage and current draw specs. for your motor?
Kind Regards,
Fahd