Damage from magnets is hardly possible
However, hard drives can be damaged by extremely strong magnets, but this is much more likely when the hard drive is in use. Typically, a hard drive is also difficult to access without removing it from a computer, so the chance of accidental magnetic damage to these components is very low. And if, for example, the read / write head is damaged, the quality of life is lower but the data is not gone
CRT monitors and televisions are also easily damaged by magnets, but the technology these devices use is extremely out of date and most people now own a plasma or LCD TV.
Except floppy disk
3.5 Floppy disks have a certain amount of magnetism, so proving that magnets can destroy data on floppy disks has reinforced the myth that magnets can also destroy components in a computer. However, if you buy a cheap magnet and place it near a floppy disk, the magnet will stick to the floppy disk and after a few seconds the information on that disk will be destroyed. You will then no longer be able to access the data.
Other storage media
In general, newer storage devices will not be affected by magnets as they have no magnetism of any kind. Although many computers, hard drives, and other storage devices have electrons in them, a normal magnet does not have the power to interfere with these electrons. This also applies to today's memory cards and flash media.
Not magnetic media
Optical media such as CDs, DVDs and Blu-ray Discs do not use magnets to read or write data, and the same applies to flash media such as memory cards, USB sticks and solid state drives (SSDs), which is why magnets cannot cause data loss on these storage media.
If you do not have a T2 security chip and FileVault activated, it is easier to rescue the data.
If you say that your hard drive is defective and your Mac cannot start and you want to recover your data, you may want to try connecting that hard drive to another Mac and try "First Aid".
Doesn't it help? Check with a hard drive recovery company that specializes in data recovery.