The gunman fired at random people with an automatic weapon as he drove into the Polish city’s Main Square, police said.