MacBook - WiFi won't connect in macOS but rebooting into Windows does? I have a MacBook Pro 2017 running macOS 10.14.3.

In my home I have a WiFi router which multiple devices connect to, including my MacBook. Recently for some reason my MacBook has been having trouble connect to it. When I manually select the network in the WiFi menu, it tries to connect to it for a few seconds and then fails with the helpful error message "Unable to connect, try moving closer" (or something like that) with no additional error information about what exactly the issue is.

After numerous attempts, it eventually manages to connect to the network but running ping 192.168.1.1 (my router's IP) or ping google.com, most of the packets time out or take 1s to reply.

Moving closer to the router does not fix the problem.

Other devices (e.g. my iPhone) can connect and work fine.

I can connect to my iPhone via hotspot, but the network performance is more or less the same. pings are terrible, even though browsing the web using mobile data on my iPhone works well.

I have Windows 10 installed via Boot Camp on my machine too. If I reboot into Windows, it connects fine and ping works great. So this leads me to believe that there is something wrong with macOS that is causing this issue.

I understand this is probably one of those questions that can't easily be solved since it could be any number of things that is causing the problem, but can anyone suggest things I can try to diagnose the issue? Can I "reset" the network stack somehow?
I figured it out. It's the weirdest thing.

My WiFi doesn't work when I have a certain external HDD plugged in via USB (Seagate Backup Plus).

I have no idea why it would be interfering with the WiFi signal. I don't have this problem with other external HDDs.

Edit

Upon further investigation it appears to be an issue specifically with the USB C to A adapter that I am using. This question is my exact issue.

The WiFi interference is strongest when I plug in my Seagate Backup Plus 4TB external HDD, a little less when I plug in my Seagate Expansion 1TB, and little or no interference when I plug in my mouse.

It probably has to do with the amount of power these devices require, and also my USB adapter is very cheap so it probably has bad shielding.

I also have an official Apple USB adapter that does not have this problem, but I don't know if it's because this adapter has a cable so it is slightly separated from my laptop, or maybe it's just better quality with proper shielding.