As Randy said, we can't always find solid logic between words in given language, however, according to some science sources, this may give some explanation:
"Spacecraft" is just a vehicle that can travel in space, hence the name.
"Cosmic rays" travel through space as well, but they're emitted by celestial objects. "Cosmic" in this case means extraterrestial, originated in outer space, coming from objects like distant stars or supernovae.
Space itself (as an empty space between objects) doesn't emit any rays, that's why "space rays" isn't correct.