Police responded by firing on the suspect, who died.
The attack forced the Capitol complex to lock down in an attack that police said did not immediately appear to be terrorism-related.
It was the second line-of-duty death this year for a department still struggling to heal from the Jan. 6 insurrection.
Yogananda Pittman, acting chief of the United States Capitol Police, told a news conference that he drove into the officers then hit a barricade and got out of the car, lunging at them with a knife in his hand.
One officer was killed and the other was injured, she said.
“It does not appear to be terrorism-related but obviously we’ll continue to investigate,” said Robert Contee, acting chief of the Metropolitan Police Department of Washington.
Police said the suspect was unknown to them, they had yet to determine what had motivated him, and they did not identify him.
“Clearly this was someone who was actively trying to just get at whoever or whatever – we just don’t know right now, so we have a responsibility to investigate that to get to the bottom of this. Whether the attack was at law enforcement, or whoever, we have a responsibility to get to the bottom of it and we’ll do that,” Contee said.
US spy agencies warned in mid-March of an ongoing threat that racially motivated violent extremists, such as white supremacists, will carry out mass-casualty attacks on civilians while militia groups target police and government personnel and buildings.
Roads leading to the complex were blocked by police cars or officers and people inside the Capitol were told to stay away for much of the afternoon before police announced that the lockdown had been lifted.
Members of Congress were not in Washington on Friday, with both the Senate and House of Representatives in recess for the Easter holiday.