It comes down to the theme "you either die a hero, or you live long enough to see yourself become the villain."
Dent had been considered the future of Gotham, a hero capable of standing up for good and helping reclaim the city from evil, and doing so without a mask. Batman was the first symbol for Gotham, and he inspired Dent just as he (Batman) intended to do. Dent was, therefore, the "white knight" who would come along and save Gotham, in the eyes of the public and in the eyes of Batman. Notice, however, that Gordon was always more skeptical and less trusting of Dent. Gordon sensed whatever it was inside Dent that was lurking below the surface and was capable of turning this seeming "white knight" into a cynical corrupted figure.
That inner nature was in fact on display during the film several times. Dent's self-promotional side, first of all, was a sign of vanity. Then there was Dent's willingness to resort far too easily to sneaky and even illegal tactics. Gordon worked within a dirty system and did the best with what he had, as he said -- but Dent reach out to actively pursue and encourage action and vigilantism outside of the law. There was a very important distinction there, and another sign of Dent's ability and willingness to be corrupted.
Then Dent kidnapped a suspect, essentially torturing the man with fear and death threats, to try and get information. This is the central important scene foreshadowing Dent's downfall, and that his true slide into darkness was perhaps inevitable and driven by something within himself waiting for the spark. Notice how the scene of Dent threatening the Joker's thug is intercut with scenes of Batman throwing Maroni off a fire escape to break his legs and torture him for information as well -- but Batman shows up and admonishes Dent for doing the same thing. Why? Because Batman is a vigilante, and to whatever extent he operates outside the law, he knows it is lawlessness on his part, and that it cannot be allowed to bleed into the actions of legitimate elected public servants like Dent, or they will never erase corruption and establish true law and order and justice in Gotham.
Dent fell from grace because everybody put their faith in the wrong knight. Everybody, that is, except Gordon. He knew in his heart that Batman was the right hero for Gotham, and that Dent might be a hero with feet of clay, a man who could too easily be defined by his flaws instead of his strengths. Gordon, I believe, recognized this true heroism and selflessness in Batman as a true hero, because he (Gordon) is recognizing something that's part of himself as well. Gordon will eventually take his rightful place right alongside Batman as the face without a mask that represents the hope and willingness to resist evil that everybody thought Dent stood for.
However, just as Gotham wasn't yet ready to embrace Batman -- because he's the hero they deserve, but he's not the hero they need right now -- the city likewise isn't ready to embrace Gordon as that kind of hero yet, either. They need someone who stands as basically an unrealistic and unattainable ideal hero, a myth of sorts that they can believe in, so that they can get through the darkness unafraid and walk out into the light on the other side. It's not unlike JFK, a very flawed man and president who has been near-deified in history with talk of "Camelot" etc, because the nation needed a fallen hero to rally behind at a time when social upheaval and warfare had everyone unsure of the present and future. Belief in something bigger than one's self, represented so purely in a martyred hero, is a powerful motivator and tool, after all.
Batman realized that the people of Gotham, despite facing so much ugliness unleashed in part due to Batman's presence and the escalation it caused, had achieved a victory together against evil. Evil sought to turn them against one another, to prove they were all hopeless and beyond redemption. And even though it was an imperfect victory (they did vote on one boat to pull the trigger, remember, and only stopped at the last moment), it was a victory nonetheless, and exactly what they needed. And instead of the inevitable death they were sure awaited them, their victory was rewarded by survival and the defeat of the evil that challenged them that night.
The city had reached a tipping point, things were (as everyone said) worse than ever, and yet they had survived it. There were casualties, terrible losses, but the city took that beating and came out intact and victorious over the evil of the day. And Batman knew that this was due to the fact that the city switched their faith and inspiration from Batman to Dent. Batman had, by the end, become a figure seen as in some ways at fault for (a) escalation, (b) not turning himself in, and (c) failing to save Dent and Rachel. He is lawlessness fighting lawlessness, and in Dent, the city thought they'd found a man who could stand up and say "we can do this together now, the right way, and we don't have to wait for a man in a mask to save us," -- and that's exactly what the city thinks happened in the end, that they saved one another and refused to turn against one another.
So Batman knows the city needs to retain the faith that brought them this far. The symbol Batman wanted to be has changed. He inspired good and hope, which created a new symbol for the city, and the city needs to continue having faith for now in that new symbol, or it will feel as if it has regressed. This created a stark choice -- does Dent get held up for the city to see him as a man who lived long enough that he became a villain, or as a man who died a hero? Gotham needs Dent to be their hero right now, and for that to happen, his crimes must be transferred to someone else. But they cannot just blame any old person for it (like the Joker), since (a) that would require the justice system intentionally charging someone for crimes they didn't commit, and (b) the person would insist on a trial and evidence of the truth would eventually come out.
Batman, however, can choose to take the blame, and refuse to reveal evidence that would be in his favor. More importantly; however, there is a very direct relationship between the city needing (for now) to not only embrace Dent, but to also REJECT Batman. They must take the symbolic step of saying, "We don't need that kind of outlaw justice, we need to do this ourselves, through the law and elected officials," as a progression toward normalcy for Gotham. Their faith in Dent is really faith in themselves and in their own future. For now, that faith is just getting to its feet; it's wobbly and uncertain, it's taking baby steps. So it needs sure footing and a smooth path, and that means for now it needs to let go of Batman's hand to gain confidence and stand on its own. That means Batman needs to be the one taking on the blame for the crimes, not Dent and not the Joker.
Only then can the inevitable happen -- a city that knows its own strength, that has rallied and joined together as one, that is not afraid anymore, and that takes yet another progressive step forward. That next step is to leave behind a need for faith in an idealized myth, and to see the nuances and hard work that requires compromise and sacrifices and rolling up your sleeves for the long haul. Which means Gordon becomes the recognized strong and sure leader they want and need -- want AND need, so that the hero they deserve is also the hero they need right now. And that is the moment when redemption for all will come, and when the city will turn once again to Batman, realize what he's done for them all along, they will forgive him whatever past failures and sins are weighing on him, and they will offer him redemption as well. This is all possible; however, because of the monumental choice Batman made to take the blame for Dent's crimes, and it will lead (in my opinion) to these final events and redemption.
I've had several recent discussions with some friends and colleagues about the upcoming film The Dark Knight Rises, and it raised additional points related to this question that I think are worth considering.
Batman's sense of guilt is overpowering at the time of the events in The Dark Knight when Dent dies. Bruce/Batman already feels responsible for Rachel's death, and both Bruce/Batman and Gordon share personal guilt over their feeling that they failed to protect/save Dent from the initial attack that left him scarred and Rachel dead. Then, they face guilt over their feeling that Dent's descent into madness was also their own doing, due to the previous failure to protect him. Finally, with Dent dying as an indirect but undeniable outcome of Batman's actions to save Gordon's son, Batman has a final measure of guilt over Dent's death, adding to his guilt over Rachel's death.
Taking Dent's guilt could be seen as a transfer of sort, of taking Dent's guilt as a way of making up for their own sense of guilt. And they may feel in fact that their own sense of responsibility (as they see it) for Dent's situation means they are really the ones most responsible anyway, and that Dent isn't totally to blame for his actions.
From that train of thought, I started thinking back to Batman Begins and the death of Ra's al Ghul. Batman said "I won't kill you, but I don't have to save you," to Ra's in that film's climax. I can't help wondering how much those events and Batman's statement came back to haunt him in The Dark Knight, and whether the end of the film is meant as a very clear rebuttal to his earlier sentiment. Because Batman saves the Joker, and then later he is pointedly unable to save Dent from his fall and is faced with the decision to either await the coin's outcome or refuse to leave things to chance and instead take direct action (the opposite of Dent's outlook, of course, but also a mirror of the fact Dent does make a choice to pick the options and to flip the coin).
There is a very slim line between Batman beating Ra's to the ground and leaving him on the train "unsaved," and Batman beating the Joker to the point he falls and then "saving" him. And I think this is brought into sharp contrast in the final moment of the film, when Batman must act to save the boy and as a result Dent falls to his death, and Batman can't save him.
In other words, is Batman undergoing a significant reassessment of his rules and his responsibilities, to the extent he questions his previous decisions and actions with Ra's, and perhaps is growing to feel guilty? Might his sentiment that he has "enough blood on his hands" have expanded to the point that he now admonishes himself for Ra's death? I ask this because I do think the end of The Dark Knight was a subtle rebuke to Batman's choice in Batman Begins, and he is still evolving as a character until he becomes that champion who is what Gotham deserves and needs.
Batman's "hero's journey" means he is looking back at his actions and history and seeing his mistakes, and that he feels a sense of regret and guilt for them. And he is trying to make up for them and become a better man and better hero, and part of that means he will take upon himself whatever burden is necessary for the city. The part of his heart and character that drives him to do this, however, once made him make take on the burden of leaving Ra's to face death, and Batman is perhaps facing this for the first time, if not overtly then at least in subtext due to the reversal apparent in comparing his choice at the end of Batman Begins with The Dark Knight.
Now that we know a certain female villain is likely to appear in the new film with the already-announced Bane, it strongly suggests that the themes discussed above will indeed come to envelop Batman's decisions in the climax of Batman Begins and it will play some role in the outcome of the next film. So I think consideration of the guilt factor, and how it feeds a broader realization reaching back into Batman's past, should also be considered when contemplating why Batman and Gordon decided to transfer Dent's guilt onto Batman.
More questions on Batman:
Follow Quora on Twitter: www.twitter.com/Quora