The incident took place in southwestern Nimroz province, the border police commander for the region told AFP.
The Iranian officer, identified as Mansoor Noori, allegedly crossed into Afghanistan several times late Wednesday on a motorcycle with another guard, said General Saifullah Hakim.
"Afghan police repeatedly warned them not to cross the border but they ignored the warnings and started firing on Afghan forces," he said.
Afghan forces responded, killing Noori and arresting his colleague, the commander said.
Afghan and Iranian security forces have launched a joint inquiry into the shooting, Hakim told AFP.
Afghan officials will deliver a formal protest to authorities in Tehran on Thursday, he said, adding that Noori's body and the detained guard would not be handed over until Iranian officials admitted responsibility for the incident.