Is there a way if malware attack the pc it can destroy or mess with the hardware of a computer too?
Am not sure about other device,
Recently CPU has been corrupted by meltdown and spectre flaw. Floppy disks, USB sticks and dvd disks have changes to contain viruses.
A really nasty virus could even corrupt your motherboard bios.
No. Computer viruses are software that are designed to spread to computer files and other computers,. If you're experiencing an issue with a hardware device, such as a printer, video card, sound card, or other hardware device, it is not due to a virus.
Speakers, monitors, printers, mouse, keyboard, and other hardware that doesn't have any computing or storage functions cannot be affected by malware but External storage media like flash drives, disk drives, and digital cameras could be infected.