The app uses a compass (if your device has it) to determine the direction. In navigation (while you move) the GPS data is used, and if you are standing still or moving at a low speed, a compass is used.
The operation of the compass depends on your device, the level of interference (magnetic fields and other environmental conditions), so you may need to calibrate the compass, for example, if the blue arrow on the map indicates an incorrect direction.
On Android to calibrate the compass, rotate your device 1-2 times around 3 axes. You can also use third-party apps to calibrate the compass, for example, GPS Status for Android (in the app menu tap Tools - select compass calibration).
On iOS the system itself will offer to calibrate the compass in case if it's necessary. To enable/disable compass calibration, open Settings - Privacy - Geolocation Services - System Services - Calibrate Compass.