How does Google map know my direction as I rotate? I realize the blue arrow on Google map, as you rotate the phone around, it will rotate as well. May I know how does it know the north south direction? It works too even my GPS is turned off.
GPS doesn't understand static direction at all; it can only infer direction from motion.  But there is an electronic compass inside the phone as well as the GPS.

You might want to download the "GPS Status + Tools" program from the Market; you can see detailed status information for both the GPS and the compass.