The air isn't attached to the Earth by any force other than gravity and friction. Think of a cup of tea. The fluid can rotate freely.
Incidentally, the Earth's core is also fluid and the crust proportionally thinner than an eggshell. The crust is free to rotate; very possible that this is the reason for the three great moves of magnetic pole. Not that the magnetic pole has moved but the crust has.