It's a complex question without a straightforward answer, especially given the fact that divergent gameplay between groups and campaigns means that D&D's dependency on killing sentient creatures varies.
The escapism angle has already been pointed out, and I won't harp on it....any more than to point out that violence in D&D is often like watching violence in 'Die Hard': John McClain is given little choice or chance to choose another option (though he tries at turns) and because of his special situation, we endorse his use of potentially lethal violence, even if we ourselves would never do the same.
First, you need to consider that morality, in-context, is different for most characters in a D&D environment. Unlike the real world, D&D characters can produce real, iron-clad proof that someone is Evil. D&D alignment provides a concrete framework for knowing whether or not the sentient/creature you're dealing with is truly evil or not. And within the context of most D&D settings, where might often makes right, lethal violence is considered a fitting punishment for someone who refuses to submit to authority...especially if that someone is potentially violent or abusive themselves. Long term rehabilitation or prisoner maintenance are strangely out of character for a game with the term 'dungeon' in the title, but there we are.
Further, this can go a long way towards determining motivation. In the situations most D&D players find themselves, they often are not the primary aggressors or initiators of the violence overall, though they may be pre-emptive in specific situations. For example: In 'Against the Giants', the characters are sent by Geoff's rulers to 'punish the miscreant giants' who have been raiding human lands and killing their subjects. It's clear that the giants respect only force, and force is what is expected to be used. A paper thin justification? Certainly, but we're back to escapism again. Another example? In Paizo's Shackled City adventure path, the campaign begins with the party searching for orphan-kidnapping slavers, who are selling people into slavery in the underdark. The party CAN negotiate with some of the bad guys and can avoid actually fighting quite frequently...if they choose that route. Some villains, however, refuse to negotiate and can only be dealt with by force.
Now, it is possible to fight and not kill in D&D, but it's a much harder route...not unlike real life.
These issues are made even more complicated when you are fighting unspeakable horrors or mindless monsters. Sure, you can drive off the owlbear...but that beholder or roper? When a demon or devil comes to call, their mere act of existence is often enough to justify full lethal violence for most settings.
To look at this from even further away: often, in D&D, the party is almost certainly goal-oriented. As often as not, the party will have no choice but to fight their way TO that goal. To get the foozle, you must slay the cockatrice. To rescue the hostages, you need to slay the Ogre leader. To stop the volcano from erupting, you must smash the altar. As often as not, the typical D&D party will choose non-violent solutions if an when they prove viable and realistic, IMHO, but often that simply isn't the case.
And, of course, is the issue of labelling it murder versus killing. Murder is, after all, a loaded term, emotionally. Does one consider it murder to put down a mad dog after it's killed someone? It's a complex question all its own. If you've ever seen "Sharpe's Rifles", there is a part where Sergeant Harper tells Lieutenant Sharpe he'll make a good "Killing officer." When Sharpe doesn't understand, Harper explains (in his Irish brogue) :
"Oh…now that’s too bad, Sir…I thought you’d ‘ave known, coming up yerself from the ranks as ye did…there are only two kinds of officers; Killing Officers and Muuurdering Officers.
Killing Officers are poor old buggers that git you killed by accident.
Muuurdering Officers are mad, bad old buggers that git you killed on purpose, for a reason…for a country or a religion….maybe even for a flag. They're mean, murdering old buggers."