It’s the perfect scenario for an action film: the villain from a foreign country goes on a crime spree and, because of international law protecting them, there’s nothing anyone but the protagonist can do about it. Except diplomatic immunity does exist.
It treats diplomats (and their families) as an agent of their host country, meaning that if you cite a diplomat for a parking violation, you’re giving their entire host nation a ticket for a parking violation. In an extreme scenario, if a South African diplomat were to be arrested for heading a cocaine smuggling ring in America, then the American diplomat in South Africa would be in danger.
Any serious crime committed would require action from the diplomat’s nation. In 1997, a high-ranking Georgian diplomat drove drunk, caused a five-car pileup in Washington D.C., and killed a 16 year-old girl. He was protected under diplomatic immunity when he was pulled over for a previous DUI, but when it happened again and an American girl was killed, the nation of Georgia waived all immunity and he was sentenced to 21 years in prison.
This is because a nation is bound by diplomatic ties to act. Because the diplomat was acting in lieu of the Georgian government, murdering an American fractured American-Georgian relations and could be considered an act of war. Which lead to the waiving of diplomatic immunity, expulsion, and eventual imprisonment of the diplomat.
The benefit of diplomatic immunity that gets used the most is that diplomats don’t need to personally pay fines. If a diplomat were to be pulled over for speeding, as is extremely common in Germany (there actually are speed limits on the Autobahn,) the fine is paid for by the diplomat’s country.
It also works for other smaller infractions like failure to pay rent. Many officials from Zaire refused to pay in 2002. Their diplomatic immunity prevented them from being evicted and the landlord couldn’t do anything about it. It was after their return home that the country of Zaire paid their debt.