I’ll bet you’ve accidentally connected to the wrong WiFi network a few times. Maybe it’s your neighbor’s unsecured network, maybe it’s something else. Avoid this problem by manually giving the networks you want to join top priority.
First, go to Apple Menu/System Preferences/Network.
Then, click on WiFi in the left-hand pane
Then the Advanced… button.
Click on the WiFi tab in the Advanced… box, then drag networks up and down in the list to set their priorities. If you see a network that you never use just click on it and delete it.
Your Mac will look for networks when it turns on or wakes from sleep, starting at the top of the list and working its way down. Obviously, your favorite network should be dragged to the top of the list.