You were probably in an area with several signals available and you may have moved to where another was stronger and your laptop picked that one. You'd need to note the list of available networks, their SSIDs, signal strength, band and channel, etc. You might even pick up signals from other devices running in AP mode that wouldn't connect to the internet. Stuff happens when the airwaves are full of radio signals.
I noticed something unusual when I used my laptop in an airport recently.
I turned it on and was able to access the airport's free WiFi from one location.
I then moved to another location in the same terminal, and was able to connect to the airport network, but not the Internet - the connection showed as "local only" (as opposed to "Local and Internet") and no websites were accessible.
I tried it from another spot just 20 feet away, and was able to get "local and internet" access, then tried it from one more spot, and got "Local" only.
Is there an explanation for this? If the Wi-Fi were only accessible from certain spots, shouldn't I have been unable to connect to the network at all from those spots, as opposed to being able to connect but getting "local only" access?