Can we detect a magnet using Arduino? If so how?
I can't comment yet but you probably are looking for a hall effect sensor.

Something like this is a simple version of the sensor. https://www.sparkfun.com/products/9312

You can then do a digitalRead on the DO pin to detect if a magnet is near the sensor. 

You would connect the Vdd to 5v arduino supply and GND to the GND of the board.