A compass needle is a tiny magnet that is free to turn. Its N end swings to point along B, the field at the spot where the needle sits. So a compass is a field-direction detector.
Far from nearby magnetic sources, Earth's field dominates. Its strength and tilt vary with location. A flat compass follows the horizontal component; this bench simplifies Earth's field to 50 µT horizontally northward. On the bench, north is away from you (up the screen) and east is to the right. Bring a magnet close and its field wins, because near a magnet B is far stronger than 50 µT.