The man had stopped his car near police and officers spotted a large knife in it and went to arrest him, police said.
The officers were treated at the scene for minor arm injuries but did not go to hospital, and the man was treated for minor injuries in hospital.
The man, believed to be in his early 20s, was arrested on suspicion of grievous bodily harm and assault.
No members of the Royal Family were in Buckingham Palace at the time.
The incident happened outside the Mall roundabout near Spur Road - which runs along the corner of the Palace grounds - at about 20:35 BST, police said.
Police said it was too early to know whether the incident was terror related.
Det Supt Guy Collings said the "quick and brave" actions of the officers meant the man was detained very quickly, and that no members of the public had any contact with him.
The man would now be questioned by detectives in police custody, he said, adding: "It is too early in this investigation to speculate any further."
Eye-witness Kiana Williamson said: "We turned up and there was one police van and one car; there was also a civilian's car that had veered towards the police car.
"They were trying to get the man out of the car, shouting; more police were arriving on to the scene and the man was fighting back.
"I saw one injured policeman with an injury to his arm, although it didn't look severe.
"He was being tended to by another officer.
"The man had been restrained and looked almost unconscious by the side of the road."
Another passer-by, who did not want to be named, said her partner initially thought he had seen a sword.
She told the Press Association: "The police didn't just run up to the car. There was some shouting prior to this; I couldn't tell you what, I was a bit panicked...
"My partner saw a sword, which I didn't see, as well as a policeman with blood on him, looking like his hand or chest was injured.
"The police officer had it in his hand, walking away with it."
A Buckingham Palace spokeswoman said it did not comment on security issues.