The so-called Doha agreement was signed in February 2020 and set a date for the US to withdraw its troops.
Gen Frank McKenzie said the deal had a “really pernicious effect” on the Afghan government and military.
Defence Secretary Lloyd Austin agreed, saying the agreement had helped the Taliban get “stronger”.
In addition to setting a withdrawal date, the Doha agreement included broad obligations on the Taliban to take steps to prevent groups such as al-Qaeda from threatening the security of the US and its allies.
After his election, US President Joe Biden continued the plan for withdrawal but with an end date of 31 August, instead of May.
The US defence officials made the comments on Wednesday in testimony to the House of Representatives Armed Services Committee.
The hearing is taking place weeks after a chaotic withdrawal at Kabul airport as foreign powers sought to get their citizens home and thousands of desperate Afghans begged for rescue. A suicide attack killed 182 people during the operation.
As head of the US Central Command, Gen McKenzie oversaw the withdrawal from Afghanistan, which marked the end of a 20-year presence in the country and America’s longest war.
Gen McKenzie told the committee the Doha agreement had a strong psychological effect on the Afghan government because it set a date for “when they could expect all assistance to end”.