Deconstructing D&D?
For most people, D&D is a game and just that. They don't think about the reasons they play at all, or what they get out of it. But I think this discussion is interesting and healthy, so I'll throw in my two cents.
I believe the violence at the core of D&D (and most RPG's) reflects a desire to escape from the complexity and nuance of the real world, where we're expected to to act in a "civilized" manner, and where our opponents and tormentors are rarely clearly identified, absolute or confrontable. D&D offers us the vicarious pleasure of not only facing unambiguous threats directly but the wish fulfillment of having power over them.
Also, D&D emulates the ethos of an earlier, perhaps simpler time, as some others have pointed out. A time when violence was considered not only an acceptable solution to solving problems, but often the only solution.
Don't forget that D&D also teaches the benefits of cooperation and teamwork. But games are primarily meant to entertain, not inform. What is more exciting, talking out your problems with the local circle of druids or bashing in the head of the orc chieftan who led the raid on your village?
I know what my choice would be . . .