Selected ahead of 30 other candidates, the 61-year-old now faces the task of taking the team to Euro 2020, which would be their third major championship in a row after reaching the Euro 2016 quarter-finals in France and the World Cup in Russia earlier this summer.
"I like the challenge and I believe we can do it," said Hamren, who has been a coach for more than 25 years at the highest level in Sweden, Denmark and Norway.
"I'm coming into a new country and new team. It's important that I won't change everything. We have to hold onto the things that have worked well in the past."
Iceland's former coach Hallgrimsson, 51, stepped down in July, saying it would be "good for the team to have a new vision".
Hamren signed a two-year contract with the possibility of an extension for another two years.
Under his leadership, Sweden qualified for Euro 2012 and Euro 2016, but were knocked out in the group stage on both occasions.
But Hamren failed to take Sweden to the 2014 World Cup after losing in a playoff to Portugal.
He previously coached several clubs in his home country, but won his only league titles with Denmark's Aalborg and Norway's Rosenborg.
Hamren had been the technical director of South African club Mamelodi Sundowns since January before resigning two days ago to take on the Iceland job.
He will be assisted by Freyr Alexandersson, who has been coaching the Icelandic women's team for five years.
The two men will begin work in September for the start of the inaugural UEFA Nations League.
"I'm very happy getting Freyr into the setup with me," Hamren added. "In the short time since I met him he has impressed me hugely."
Iceland are to face Switzerland on September 8 and Belgium on September 11.