malware
Most programs are tools that do what you asked. Malware — short for malicious software — is a program written to harm you, your data, or your computer, usually while hiding its true intent. Calling it one thing is a little like calling all illnesses disease: useful as an umbrella, but the interesting part is the different kinds, because each spreads and damages in its own way, and each calls for a different defense.
The classic taxonomy turns on how the malware spreads and what it does. A virus attaches itself to a legitimate program or file and runs when that host is run, copying itself into other programs — it needs a host and usually a human to launch it. A worm is self-propagating: it spreads across a network on its own, exploiting bugs in services, with no host program and no human help, which is why worms can blanket the internet in hours. A Trojan horse pretends to be something useful — a game, a codec, a free tool — so that you install it yourself, and only then does it do its hidden harm; it does not self-replicate, it relies on deception. A rootkit is malware that hides itself and other malware by burrowing deep, often into the kernel, subverting the very operating-system facilities you would use to detect it. Ransomware encrypts your files and demands payment for the key. Spyware silently watches and exfiltrates what you do, type, or store. These categories overlap freely — a single real attack might arrive as a Trojan, drop a worm-like spreader, and install a rootkit to stay hidden.
Malware matters to operating systems because the OS is both the target and the main line of defense. Many techniques in this whole field — least privilege, sandboxing, no-execute memory, code signing, secure boot — exist precisely to stop malware from getting in, running, spreading, or hiding. The honest, sobering point is that no single defense catches everything: signature-based antivirus misses brand-new threats, sandboxes can sometimes be escaped, and a rootkit that reaches the kernel can lie to every tool above it. That is exactly why defense in depth and a small trusted computing base matter so much here.
A user downloads a cracked game (a Trojan horse). Running it installs ransomware that encrypts their documents and a rootkit that hides the malicious process from Task Manager. The Trojan got it in by deception; the ransomware did the damage; the rootkit kept it hidden — three categories, one attack.
The categories describe spread and behavior, and real attacks mix them.
Signature-based antivirus only catches malware it already recognizes, so it inevitably misses brand-new threats. And a rootkit that reaches the kernel can subvert the very tools you would use to find it, which is why detection alone is never enough.