How does a tracking device like a Garmin watch or Strava mob app know what elevation you are, no matter where you are?
It’s part of the calculations with the GNSS received data.
There are some gotchas and not all receivers are good at it, but it does do the trick.
Because there’s only one possible elevation you could be when driving or walking, which is ground level. If you’re travelling down a road Garmin can just assume you’re at whatever elevation the ground is. Smartphones use the accelerometer, not GPS, to detect if you’re going up or down stairs.
GPS gives you a point in *space*, not just a point on the earth’s surface. From that, you can calculate your terrestrial location and altitude above sea level relative to the earths surface. Most map apps ignore the altitude data but it’s still there and aircraft can use it.
It’s just GPS, because of the way it calculates your location it always knows your altitude too, not just latitude and longitude. Flat street maps just don’t show it, because it’s no use to you.