- Why are these threats possible?
Because computers are little more than tools. The term "computer" is very descriptive despite all of the abstraction that we attempt to layer on top of them; it is a device that "computes", plain and simple. Whether, at any given nanosecond, it is computing the color of a pixel in a UI, the address of data in its memory, etc, it is no more or less than an incredibly fast binary calculator hooked up to a lot of peripheral components that provide inputs to and outputs from the basic programming the CPU is currently churning its way through.
Given that, the question of "why" has a simple answer; tools can be used for good or ill. Hammers can pound nails or skulls. Saws can cut wood or flesh. And computers can sequence DNA to find the cure for cancer, or steal your bank account information.
- Why doesn't the computer just do the things it is supposed to?
It does. It does exactly what it is told to do by the program that it is currently executing. The problem is that the program the computer is currently executing isn't necessarily something you told it to execute explicitly by the stroke of a key or the click of a mouse. For a very long time now, we've used multiple layers of software (and hardware) to allow for modularity; any computer can have any hardware plugged into it, and run any program to work with it (at least that's the theory). More recently we have invented layers to allow a computer to juggle many programs at once. These layers of abstraction such as the OS, virtual machines, daemons (services), etc, which hide what the computer is really doing on any given clock, can be manipulated by an attacker to run software without your conscious knowledge.
- Why do some people write malware, instead of programs with a constructive purpose beyond doing damage and violating the law?
...some men aren't looking for anything logical, like money. They can't be bought, bullied, reasoned, or negotiated with. Some men just want to watch the world burn. - Alfred Pennyworth, The Dark Knight
For most "black hats", the mayhem they cause is fun, it's entertaining, the same way you or I would enjoy a video game in a completely sandboxed environment. They, however, are doing things in the real world. Same layer of digital separation between you and the consequences of your actions, with the added thrill of knowing it's real.
- Does computer insecurity exist because of the nature of computers?
To a point, yes. Computers are powerful, but they are extremely dumb. They require humans to do their thinking for them, to design them in a way that is difficult to subvert, to program them in a way that is difficult to subvert, and to use them in a way that is difficult to subvert. The inherent difficulty of this is similar to the inherent difficulty (maybe the impossibility) of designing a "completely foolproof system":
A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools. - Douglas Adams
In both cases, you're very simply trying to pre-emptively outsmart someone willing to spend a lot of time and effort finding a way to misuse what you're designing once the finished product has left your hands. You effectively have to come up with the same ideas that the other person would have, and incorporate mechanisms to defeat that line of thinking. The more complex the system is internally, the more of those ideas become possible, and the less likely you are to have thought of everything. The more you put in place to prevent misuse, the more complexity you add. It's a vicious cycle.