I have a Moto G android smartphone with the usual Google gubbins installed. One feature of Google accounts is that as long as wifi and/or mobile data is enabled, they can track you, something I find useful as a delivery driver. You log into your Google account, click on account data, and it shows where you've been on any selected day, along with time stamps and (more or less) exact locations. It even plays a timeline video of where you have been. This morning either me and the phone, or the phone itself flew 3 miles directly west twice to the nearby Radio/TV transmitter. First at 00.50 and again 5.20. Note to self: must stop flying over Wales in my sleep.
It certainly is very odd. I understand there is some trial and error in the system where the location will be a few metres out, but this is silly.
Your GPS probably lost connection and so you were triangulated via WiFi, which can be a few miles out. I often find myself in the middle of the River Humber! If you look at the permissions of the app that is tracking you, you will see that it has access to your course location (via WiFi) and your precise location (via GPS)