Sweden and Finland are hockey superpowers; Norway, not so much. Hockey is a big deal in Latvia but not Estonia or Lithuania; in Belarus but not Ukraine; in the Czech Republic but not Poland.
Then there's Germany and Switzerland, which have well-attended professional hockey leagues but usually aren't contenders at the Olympics or other international competitions. (Germany's surprising silver medal in this year's Winter Olympics notwithstanding.)
Why did the sport catch on in some countries, but not their neighbours?
I think the premise of the question is a little flawed.
I don't think you can look at countries like Norway, Poland, etc and say hockey didn't "catch on". Norway, for example, is a country that competes in the top tier internationally off and on, for example. IIHF (International Ice Hockey Federation) currently ranks Norway's Senior Men's team 9th in the world.
http://www.iihf.com/home-of-hockey/championships/world-ranking/mens-world-ranking/2018-ranking-feb/
Germany and Switzerland, which you mentioned, are currently 7th and 8th in the world respectively.
A lot of it is simply a matter of finances though. Slovakia not-too-long-ago was considered on the lower end of one of the "powers", but experienced some fairly public problems funding their youth hockey developmental arm and the result was as one generation of players aged out/retired, they didn't have the same caliber of player overall stepping in to replace them.
The step below the big, major international level in IIHF is "Division I", which is where countries like Denmark, Latvia, Slovenia, Poland, and Ukraine spend time off and on. If they have a good run, they can make it up to the "elite" level with USA, Canada, Russia, etc, and they do off and on. At this level, these countries also still can supply a handful of players to the NHL, and also the Russian KHL (which is probably the second-highest caliber league in the world right now). Just because a guy is playing in the KHL and is maybe more-invisible to North Americans doesn't mean he's not high-caliber, and these guys are VERY much on the radar of NHL scouts at all times. So they're a quick step away from the NHL in many cases.
So anyways, it's tough to say that hockey hasn't "caught on" if you're looking at these factors. In a lot of the cases it's a simple matter of funding, because without the finances and resources it's become much more difficult to develop and compete with the "powers" as you say like Canada, Russia, USA, Sweden, etc.