Please check the following Apple articles:
Check the status of your network on Mac
Check the status of your network on Mac - Apple Support
You need to have a good Service and/or Wi-Fi.
If they are On, turn Off Hotspot & VPN.
Charge the battery > 70%.
Turn Off VPN, see -> Change VPN settings on Mac
Change VPN settings on Mac – Apple Support (UK)
Make sure you don't have a firewall enabled: Change Firewall settings on Mac – Apple Support (UK)
If your Mac isn't connecting to the internet over Wi-Fi
If your Mac isn't connecting to the internet over Wi-Fi - Apple Support
If you can't connect to the App Store, iTunes Store, or other Apple services
If you can't connect to the App Store, iTunes Store, or other Apple services - Apple Support
👉 If you tried all of the above steps and you still can’t connect, contact Apple Support.