During the Cold War, the United States and Soviet Union were competing with one another for global and political dominance. With that in mind, neither side could afford to fall too far behind the other in its scientific and technological capabilities. These concerns, as they related to the power dynamics between these two States, were driving features which shaped both the Space Race and the Arms Race.
In some ways, the Arms Race is the more easily grasped of the two. Ultimately, the stakes here are fairly clear cut. The Arms Race refers to weapons technology (most famously to weapons of mass destruction), with both sides spending tremendous energy building and maintaining their own nuclear arsenals, as well as improving the technology involved.
As far as the Space Race is concerned, one should not forget the degree to which it was itself actually quite closely linked to the Arms Race. For example, consider that Sputnik was launched into space by the world's first Intercontinental Ballistic Missile. In that respect, the Space Race has its very origins in the Arms Race. Irregardless, space technology certainly had military applications, not only in terms of the militarization of space (there were concerns that the Soviet Union would establish nuclear arsenals in orbit) but also in terms of more general technological and scientific capabilities and knowledge.
In that respect, I would say that the Space Race and the Arms Race were closely intertwined. Regardless, the stakes were high, and in both cases, neither country could afford to ignore the progress (or potential progress) of its adversary, lest it risk falling behind on the technological curve. Scientific and technological advancement was one of the critical theaters in which the Cold War played out.