The Switch can either fail to connect to a network during the initial setup, or it may lose the connection later.
Causes of Nintendo Switch Not Connecting to Wi-Fi
The Nintendo Switch can either lose its connection, or fail to establish one, for a variety of reasons. Some causes include:
Nintendo Switch Online or other services are down. Your Wi-Fi network is down. Your Switch is out of range of the router. Your network’s security key is incompatible. A firewall is preventing the Switch from accessing your network.
What to Do When Your Switch Won’t Connect to Wi-Fi
Try these troubleshooting options in order to get your Switch back online. If nothing works, you’ll have to get in touch with Nintendo’s tech support. If your Switch is connected to its dock, try moving it closer to the router. If you have a combination router/modem, unplug it, wait about a minute, and then plug it back in. Try the connection again once it’s completely started up.