This question was asked in Bar Magnet

Why does a compass needle get defelacted when brought near a bar magnet?

jinvani Sandes's image