Hello AdrianESNL,
Thanks for asking the Apple Support Communities for help with your Mac connecting to Wi-Fi.
1. Please start by ensuring everything is followed in this help article: Connect your Mac to the internet - Apple Support
2. Next, it may be beneficial to try Wireless Diagnostics: If your Mac doesn't connect to the Internet over Wi-Fi - Apple Support
3. Also verify if this is only occurring in specific areas due to interference: Resolve Wi-Fi and Bluetooth issues caused by wireless interference - Apple Support
4. Ensure the network you are connecting to meet the recommended settings for macOS: Recommended settings for Wi-Fi routers and access points - Apple Support
5. If you still have issues, try creating a new network location and testing. Go to System Preferences > Network > Location top center > Edit Locations. Create a new location using the + symbol. This article should help: How to use network locations on your Mac - Apple Support
If the new location is working, use the bottom portion of the article to prevent the other network that isn't working properly from being used.
Thanks and have a wonderful day.