Q:

Why are vulnerabilities and lack of security possible in computers?

I have heard about computer vulnerabilities, virus, malware, etc.

Why are these threats possible?
Why doesn't the computer just do the things it is supposed to?
Why do some people write malware, instead of programs with a constructive purpose beyond doing damage and violating the law?
Does computer insecurity exist because of the nature of computers?

A:

The computer cannot guess what it is "supposed" to do. Instead, it does exactly what it is told to do -- that's what programming is about. As a corollary, computers have no initiative whatsoever, so if they are asked to do something stupid or nonsensical then they just do it.
A bug is what happens when the sequence of instruction written by the programmer makes the computer do something stupid when presented with a specific set of data -- that is, stupid with regards to what the programmer wanted the computer to do in his high abstract picture of the system. But the computer does not know what the programmer wants, and even if it knew, it does not have the power to "understand it". The computer just follows the instructions to the letter.
A security issue is a kind of bug which can be exploited to the advantage of a malevolent third party, who will trigger the situation where the bug occurs in order to benefit from the nonsensical behaviour of the computer.
So, to sum up, security issues occur in computers because bugs exist and because evil exists.
Existence of bugs is due to the fact that making bug-free software (or, for that matter, bug-free hardware) appears to be overwhelmingly hard. This is an active research area and it is not ready to deliver anything workable yet. As an anecdotal example, consider that the program used during Apollo 11 Moon landing had two bugs to the effect that Neil Armstrong had to go in american-manliness-overflow mode and use the manual control. If they could not make a bug-free program for the main computer of a 25-billion dollars program, how do you expect average programmers to do better ?
Also on the matter of formal verification, ponder this well-known quote from Donald Knuth: "Beware of bugs in the above code; I have only proved it correct, not tried it."
Existence of evil is also an open problem which has been researched for at least 4000 years and does not seem to be solved any time soon.

A:

Does computer insecurity exiss because of the nature of computers?

Actually yes, yes it does. Everybody and their dog will tell you it is because people are stupid which is pretty much true in the sense we are all imperfect, but this is not quite the whole story.
Basically, a guy who is essentially the Hungarian-born version of Feynman invented the modern architecture of computers, called Von Neumann Architecture. The basic essence of this is that programs and data are all stored in the same place in memory and one can manipulate the other.
So, using the usual humans are computers metaphor, imagine you have a friend who can only read instructions from a piece of paper and do exactly what they say, discarding the complexities of humans having different interpretations and all that social stuff that's ruining my metaphor. In this case, your friend is in a library. You hand him a piece of paper. He blindly follows your instructions and by the time he has finished (which is remarkably quick, by the way) he has sorted your album collection alphabetically AND had time to tell you he needs an update.
Now, Mr Malicious is a nasty piece of work. He takes a piece of paper, writes "buy a gun, rob a bank and stamp on the beatles albums in the collection you just sorted" and stuffs it in a Chesney Hawkes Album. Then he gives your friend some instructions which surprise surprise involve him opening the Chesney Hawkes album and reading those instructions. Oh, a piece of paper with instructions on! Jumping up and down on the beatles albums, he sprints out to buy a gun and rob a bank.
See - programs are data. They are stored in the same place. This is an immensely useful feature, an explicit design feature of modern computers. It allows us to have compilers that take data and produce code, have dynamic languages and all kinds of other wonderful things. But it also brings about the insecurity of being able to accidentally execute things that should be data as code, and thereby make the computer proverbially drive itself off a cliff.
There is an alternative and it is called the Harvard Architecture. In this scenario, code and data are separate things and one cannot put malicious code where data should be, because Harvard Architecture processors would just look at and go "yeah right!". This does not mean such PCs could not crash - quite the contrary, the logic instructions can still contain bugs - it's just we wouldn't be able to exploit them so readily.
HA also has some severe limitations. You could write compilers for one, but you wouldn't be able to test what you wrote without first transferring the program from data storage to code storage. Dynamic languages get much, much harder. Programs updating themselves gets difficult. And so on.
So, yes, it is the nature of humans to not always get everything right, and it is the nature of computer architecture that this fact can be leveraged to do bad things.
That does not mean to say there are not workarounds - indeed W^X and the NX bit are harvard architecture like concepts for the von neumann x86 backend. 
Notes:

Technically, an x86 CPU is a modified Harvard Architecture. The backend (bit you program from) is Von Neumann, the core is Harvard.
The metaphor is slightly cliched and not perfect. I know. Sorry.

A:

Insecurity in computers exists for pretty much the same reason computers are so good at what they do:  They follow the instructions they're given, precisely.  The root of the problem, as @JeffFerland succinctly put it, is that those instructions are written by humans.  This is a problem for two reasons:  Some humans have malicious intent, and others, well-meaning individuals, are simply fallible.
The first half of the issue is obvious.  Bad people write software that does bad things.  Then, they get the software to run on other people's machine through social engineering or other means.  They do this because there is profit in it, or they may have a certain political or personal agenda.
The second half is where we run into problems like Flash and Java - programs otherwise intended for good purposes, which inadvertently facilitate execution of malicious code.  This happens because programmers, as humans, are imperfect.  As such, sometimes the code they write is imperfect in such a way that computers (which will still follow the code's instructions perfectly) running their programs can be leveraged by malicious actors to run their bad software.
Think of the computers as if they were Amelia Bedilia.  When Mrs. Rogers tells Amelia Bedelia to "measure two cups of rice", she of course means for Amelia set out two cups of rice for Mrs. Rogers to use when she gets home.  However, only following the instructions exactly as they are given, Amelia pulls out two cups of rice, takes some measurements, and puts the rice away.  Sometimes, a programmer will do something similar - they will write instructions with a certain intent but, when the computer executes them exactly as written or is allowed to incorporate user input into those instructions, the computer may end up doing something the programmer or user did not intend or expect.

