Why does a compass needle get deflected when brought near a bar magnet?
A compass needle is a small bar magnet. when it is brought near to another bar magnet their field lines interact with each other.
Hence, the compass needle shows deflection.