We went into Afghanistan and Iraq in order to crush Iran in the middle. Then Iran started insurgencies and Bush lost his nerve.
Ever since Vietnam no president wants to be known as the Commander in Chief who presided over us either losing a war or being in one that lasted too long (and we should have won easily). Too many people still think of Vietnam as "Nixon's war" when he had nothing to do with getting us into it or making it last long -- he got us out of it the first year he was in office. Yet his name is the one associated with a war that many consider to be a stain on America's record.
Fast forward three decades and we were in a long war with Afghanistan, IMHO because Bush didn't go to war to win it (you know, the "win over hearts and minds" stuff and "we'll fight the war on terror the rest of our lives" stuff and "there won't be a treaty signing moment like on the USS Missouri" stuff). So what do you do if you're Bush? It becomes easy to start a new war in Iraq so everybody will forget the long drawn out war in Afghanistan. In Iraq he could make up a new objective that's attainable -- replace Saddam -- instead of the abstract unattainable goals of the Afghanistan war. So he could end his presidency as a winning president (we did get rid of Saddam).