There are more people per square mile in both Italy and Spain than there are in Sweden, which makes the disease easier to transmit.
Even density doesn’t get you there.
Consider each physical or near physical contact a given person has.
Diseases 'relying on transmission between humans require these contest.
When you consider these, you get webs, connected to more plans, connected to still more.
For the infection to survive, it needs each infection to, on average, infect more than one person from each infection. The base rate, for “normal” circumstances, is R0. R itself is the value based on changes (e.g., social distancing), and is what matters.
Regardless of everything else, separating people, isolating areas, etc., will change R–but it has to be reduced to below 1 for the infection to shrink, rather than grow.
If the number of infections is low, even with an R0 of, say, 2 to 4 (which I think is what is attributed to this one.), there will still be a small number of infections. That is, if three people are infected, they will infect six to twelve more. So “not a lot” doesn’t mean “there won’t be three times as many in two weeks”; it’s just a matter of where that link is.
So cut those connections in the web, and R goes down. Cut them enough, and the infection starts dying. Cut them less than enough, and growth isn’t
as fast, but it still grows.
This is also why countermeasures don’t have to be perfect, just generally effective.