The reason Al-Harith bin Suwayd al-Ansari was killed is that he took the life of some people unlawfully. Hence, he was killed for this crime.
THE JEWS ARE JOINED BY ANSARI HYPOCRITES
The following hypocrites from al-Aus and al-Khazraj joined the Jews according to information given me. God knows best about the truth. From Aus of the section of B. Amr b. Auf b. Malik of the subdivision Laudhan b. Amr. Auf: Zuwayy b. al-Harith. From Hubayb b. Amr b. Auf: Julas b Suwayd b. al-Samit and his brother al-Harith. Julas was one of those who withdrew from the apostle in the raid on Tabuk. He said, ‘If this man is right we are worse than donkeys.’ Umayr b. Sa’d, one of them, who was closely related to Julas, he having married his mother after his father’s death, reported what he had said to the apostle. But first he said to Julas: ‘You are dearer to me than any man, the most generous to me, and it it is most painful to me that anything should happen to upset you; but you have said words which if I repeat them I shall bring shame upon you, and if I keep silence I shall bring my religion into peril. One is preferable to the other. Then he went to the apostle and told him what Julas had said. Julas swore by God that he had not said the words attributed to him by Umayr. And God sent down concerning him: ‘They swear by God that they not say, when they did actually say, words of unbelief and did disbelieve after they had surrendered themselves. They planned what they could not carry out and they had nothing to avenge but that God and His apostle had enriched them by Hus bounty. If they repent it will be better for them; and if they turn back God will afflict them with a painful punishment in this world and the next. In this world they have no friend or helper’ (295).
It is alleged that he repented and was known to be a good Muslim. His brother al-Harith who killed al-Mujadhdhar b. Dhiyad al-Balawi and Qays b. Zayd one of B. Dubay’a at Uhud, went out with the Muslims. He was a hypocrite, and when battle was joined he fell upon these two men, killed them, and attached himself to Quraysh (296).
Mu’adh b. Afra killed Suwayd treachersly when there was no war. He shot him with an arrow before the battle of Bu’tah. The apostle-so they say-had ordered Umar to kill him if he could get hold of him, but he escaped and got to Mecca, Then he sent to his brother Julas asking for forgiveness so that he might return to his apostle. 
Muhammad Ibn Abdul W.
Ibn Ishaq said: ‘Among those of the hypocrites who were named for us from Al-Aws and Al-Khazraj were: Zuwayy Ibn Al-Harith and Al-Harith Ibn Suwaid Ibn As-Samit.’
Ibn Hazm said: The messenger of Allah killed him in retaliation (for someone whom he had unlawfully killed). 
Don’t forget to follow Discover The Truth on Facebook and Twitter. PLEASE help spread the word by sharing our articles on your favourite social networks. Thank You! Jazaka’Allahu Khayran.
 Ibn Ishaq’s Sirat Rasul Allah – The Life of Muhammad [Translated by A. Guillaume], Page 242 – 243
 Biography of the Prophet by Muhammad ibn Abdul Wahab, volume 1, Page 381