What can be done with a 10 year old MacBook that if full of possible viruses or spyware to the point it is useless?
Put Linux or Windows on it. You could reformat by making a bootable OS X retaliation drive (or whatever the latest macOS that supports it) and reformat the whole thing. But 10-year-old hardware would run better with a Linux distro than it would Windows 10 or OS X/macOS.
Doorstop
Use another Mac to make a USB OSX/MacOS installer, erase the drive, and install a fresh OS on it.
If it’s still got an HDD, consider tossing an SSD in there.
Take out and destroy the SSD/HDD if you can and then install a new operating system (windows, Linux, macOS). It might still have some residual traces left after formatting.
Wipe and reformat the HD, install an SSD if it doesn’t have one, and use Open Core Legacy Patcher to run the latest version of Mac OS on it. It won’t be powerful, but would be fine for browsing and basic work.
What do you want to do with it? Use it as chopping board, display it on shelf, reformat it and use it as normal laptop for lightweight task, sell it, throw it away, donate it…
The possibilities are endless
Declutter your life and get rid of it.
If it’s a 2013 it already has an SSD.
No “virus” or malware is going to survive a reformat on a Mac, simple as that. It can’t “lurk” anywhere one partition tables have been destroyed.
You’re SOL if it’s a 4GB model as RAM isn’t upgradeable but it should still be useable under Catalina if Big Sur performance isn’t good enough. If it has 8GB then you have a better chance.
As you’re asking a question like this I’m guessing you’re not au fait with Mac troubleshooting. Start by going to /Library and look for items in /LaunchAgents and /LaunchDaemons. Use Finder’s “Compress” option to zip up whatever you find and delete the original items. This will stop them loading at startup while allowing you to restore them if needed. In System Preferences go to Users & groups and look at your startup items. Delete anything you don’t want. Finally give the system a Safe Boot as it will perform a drive check and clear out various temp files in the system folder. When you’ve done that you can give Onyx a run at clearing out various caches. It’s the only utility of this sort I trust and use as it’s been around for years and doesn’t introduce any background services or unwanted extras unlike some heavily advertised Mac utilities.
Format it, opencore it to an usable version, and use it as a Chromebook. Otherwise use it with Ubuntu.