The explosion happened in the southern province of Kandahar, local officials said, adding the security guards were escorting the logistics convoy destined for NATO's International Security Assistance Force (ISAF).
"The attack took place around 6:30 pm, a suicide attacker detonated his car loaded with explosives near the private security firm," Zalmay Ayoubi, a spokesman for the governor of Kandahar, told AFP.
"He targeted the logistic convoy. As a result, two people were killed and 21 injured." Ayoubi named the security company as Afghanistan Naween and said the attack happened close to the firm's premises.
All the dead and injured belonged to the security firm with the exception of one of the wounded, who was a civilian, Ayoubi said.
ISAF, which has about 130,000 troops in Afghanistan fighting a Taliban-led insurgency, uses private companies to transport and protect logistics convoys in the war-torn country. Kandahar, birthplace of the Taliban, is one of the deadliest areas in the nearly 10-year conflict.