Tape inside cassette shells stores information when the recording device arranges tiny magnetic particles on the tape. It plays back when it moves over the electromagnetic head in a tape player and the movement causes a varying magnetic field that is interpreted as sound.
Powerful magnets can distort or erase recorded cassette tapes when they are in close proximity. Even a refrigerator magnet is powerful enough. Cassette tapes should always be stored away from magnets of all types.