Magnets near electrical equipment are fine unless there is a tube, or something is moving like the magnet or the data/signal carrying material.
In this case, there is a hard disk with spinning platter containing magnetic data.
The metal housing for the hard disk provides a very good magnetic circuit that effectively short circuits the magnetic flux away from anything else, but its not a perfect system.
A tiny amount of flux will still be present.
Over time, as the data on the disk passes through the magnetic field, it will slowly be drawn toward/away from its polarity, averaging its flux toward less magnetic, reducing the datas signal strength.
If left long enough and enough errors occur on the disk surface in succession (ie long enough to be outside of the scope of the error correction), you can lose data.
An SSD wont be affected by a stationary magnet, fyi.