Nothing in Newton’s writing suggests that he chose it because it was somehow “magic”. But he does state that he chose it by analogy with musical tones. That sort of makes sense when you see how the spectra start to repeat in sequential “orders”, just as octaves on a piano follow one another. Newton would have seen this i several phenomena, most notably in what have been called “Newton’s rings” in his honor.
Before he decided that colors in the spectrum came in groups of seven, he had thought that there were four distinct colors (some parts of his book Opticks still contain discussion of the four colors, although he revised it to seven in most places.) He based his divisions on the proportionate variations in the musical scale. Although Newton did not hold with the wavelength theory of light, he did know (from his work on Newton’s Rings) that there was a characteristic length associated with each color. So it wasn’t just the number of colors that came from the analogy to musical scales – it was also their spacing.
In addition to red, yellow, blue, and violet, from his original four, he now had gaps to fill in with the other three, their positions dictated by the relative spaces in the musical scale. Orange and Green were pretty obvious, but the color between blue and violet was more difficult. Even Newton’s friends had trouble discerning a different color in there, and he cajoled people into agreeing with his contention that there was a different color in there, because the theory said there had to be. Newton decided to call this color “indigo”, not because it really was the color, or because that color was the perfect exemplar, but because he needed a name, and that color looked, to him, pretty much like what he wanted.
Indigo is the dye used to color blue jeans, and I would unstintingly call it “blue”, but the name has persisted. I suspect part of the reason is that people like the idea of seven colors, and it also gives Roy G. Biv a last name that, if not believable, is still pronounceable.
I also note, however, that most of the “rainbow” flags only have six colors, leaving out Indigo.
I also note that the Uniform Color code used for resistors, which follows the spectrum except at the ends, also dispenses with indigo. You want . easily distinguishable colors on your resistors, and I have no doubt that using indigo as a color in the code would have caused no end of confusion.
finally, I have to observe that there’s not really any reason to divide either colors or notes up into octaves or seven colors. Both scales are arguably continuous ones. You can easily interpolate colors or notes by using frequencies between the standard values. In fact, the "“standard” values of the musical notes depend upon the temperament you are using (and brings up the interesting question of what Temperament Newton was using when he calculated his colors. I answered this in an article I wrote a couple of years ago. But the difference aren’t really large enough to affect the way the colors appear.)