Police arrested the suspected gunman at the scene of an attack that shocked many in Japan, which is one of the world’s safest nations and has some of the strictest gun control laws anywhere.