There was no immediate claim of responsibility. However, al Qaeda-linked al Shabaab militants have kept up guerrilla-style attacks and kidnappings in the city despite being largely pushed out by Somali and African forces two years ago.
Witnesses said the Swede going back to her hotel after giving a speech at the University of Somalia when the gunmen struck near the Turkish embassy.
Student Ahmed Dek said the Swedish woman flung open the rear door of the car and ran under a hail of bullets towards the university. She was bleeding badly from her left side, he said.
A police officer guarding the Swedish woman and a Somali man said to be her translator were killed, police said. A Somali woman from Sweden was also wounded.
Bile Ibrahim, of the criminal investigation department, said police were investigating a possible attempted kidnap.
The Swedish Foreign Ministry confirmed a Swedish woman had been shot and injured and said it was investigating the circumstances of the attack.
The ministry said preparations were under way to move her to Kenya after treatment in Mogadishu. A spokesman for the U.N. hospital there said her wounds were not life threatening.
Somalia has a new elected government that has been in charge for about a year and is attempting to rebuild itself after two decades of civil war and lawlessness, triggered by the overthrow of president Siad Barre in 1991.
Last week, a medical charity that was a lifeline for hundreds of thousands of Somalis announced it was pulling out of the country, saying the threat of deadly violence had become intolerable.
(Additional reporting by Anna Ringstrom in Stockholm; Writing by James Macharia; Editing by Alison Williams)