How did scientists come to the conclusion that it is space that is expanding and not galaxies moving away from each other as in a giant explosion?
The simplest explanation relies on the statistical unlikelihood of us being at a special place and time in the cosmos. Let's say, for a moment, that we see galaxies moving away from us because of some cosmic explosion that set them in motion. In that case, we would expect to see the galaxies in one direction moving faster than the galaxies in another. Looking towards the center of the explosion, we would see galaxies on the other side moving much faster than if we looked in the other direction.
This, however, is not what we see. What we observe is all galaxies moving away from us, with a speed proportional to their distance from us. That means that the further away they are, the faster they are moving. It doesn't matter what direction we look in; a galaxy 500 Mpc away in one direction will have a recessional velocity approximately the same as one 500 Mpc away in the other direction.
This forces us into one of two conclusions: either we are at the exact center of the universe, which is statistically impossible, or space itself is expanding, so everything is moving away from everything else. The animation below shows how this would work. From any given point in space, it would look like everything is getting further away from you.
Explaining the recession of galaxies due to an explosion also raises many questions: What caused the explosion? Why would it start at one particular point? What were things like before the explosion? All of these are questions which do not have accepted answers. Instead, the expansion of space ties directly into the idea of the Big Bang. The expansion of space itself is what drove the Big Bang. It is not that the universe is expanding into something. Instead, space itself is expanding. However, the topic of the Big Bang is a different subject, so you can look up information on that yourself.
This excellent question continues to confuse laymen as well as professional astronomers. In the standard, general relativistic (GR), cosmological model, the Universe is described as expanding, with galaxies lying approximately still in space and being "dragged along". Thus, every observer sees the other galaxies receding. The Universe started out in an $\sim$infinitely dense state — either finite or infinite in size — and has been expanding ever since, not into something, but "by itself".Special relativistic model
A more intuitive, "explosion-like", description of the recession of galaxies would in principle be possible: In this model, Big Bang happened at a specific point in an otherwise empty space. Particles traveled outwards from this point at all possible velocities less than $c$ (left panel in the figure below). The slow particles are still close to this special point; the faster ones are farther away, and the fastest ones — traveling at almost $v=c$ — comprise a "surface" of the cloud of debris. In this model, the Universe is not isotropic. But to any observer who is not at the edge of this cloud of debris, it would look isotropic, at least for a sufficiently small region of the cloud, and the observer would still see galaxies recede at velocities proportional to their distance from him/her. All it requires is that the observer's observable Universe is sufficiently small.
Thus, the answer provided by Phiteros is unfortunately wrong, and is not a proof that the SR model is wrong.
The time dilation of various "standard clock" processes in distant galaxies (e.g. the time it takes for a supernova to fade away) has been proposed as a way to distinguish the GR model from the SR model. However, it turns out that the time dilation factor in the same in the two models, namely $1+z$, where $z$ is the redshift of the galaxy. So this doesn't work either. It does, however, rule out models that don't predict any time dilation at all, such as the "tired light" hypothesis.Supernova magnitudes
The best "proof" (in quotes because nothing is ever really proven in physics, only verified or falsified) of GR is given in Davis & Lineweaver (2004), I think. Because of the mechanism that makes supernovae type Ia explode, these objects are thought to reach a known brightness at their peak luminosity, and can thus be used as "standard candles". Plotting their magnitudes (in the $B$ band, taken from Perlmutter et al. 1999) $m_B$ vs. their redshift, the result can be compared to the predictions of various cosmological models. In the standard GR model, the result depends on the history of the expansion, which in turn depends on the densities of the various constituents of the Universe (baryons, dark matter, dark energy, radiation). This is the reason that SN1a can be used to constrain the densities of the components. In the special relativistic (SR) explosion model, however, the result only depends on the velocity of the emitter at the time of emission, and the velocity of the observer at the time of observation. Whatever happened in between doesn't matter (in this models nothing special happened in between$^\dagger$).
The result is shown in the figure below for various GR models (thin black lines) and for the SR model (thick black line). The SR model is ruled out at $23\sigma$.
Figure 5. from Davis & Lineweaver (2004).
$^\dagger$As the authors note, "1) SR could be manipulated to give an evolving Hubble’s constant, and 2) SR could be manipulated to give a non-trivial relationship between luminosity distance, $d_L$, and proper distance, $d$. However, it is not clear how one would justify these ad hoc corrections".
Phiteros' answer is spot on. We believe it is space that is expanding since the alternative has a near zero chance of being true. But I wanted to provide another, related piece of the puzzle $-$ The Cosmological Principle. This is notion that
the spatial distribution of matter in the universe is homogeneous and isotropic when viewed on a large enough scale.
What this means is that no matter where you are in the Universe, be it on Earth or in a galaxy far far away, the universe will appear to look the same to you in every direction you look. If this principle is true, it implies something very important about our universe: There is no "special" location in the Universe which distinguishes it from the rest of the Universe.
If the universe was expanding from a single point due to an explosion, that point of expansion would be the center of the universe and thus hold a special significance. If you were at that point, you'd know it. Any observations at that point would clearly look different than if you were anywhere else in the Universe. If the Cosmological Principle is true, that point can't exist.
If someone really spends the time to think about it, this isn't a great reason as to why we know space itself is expanding (Phiteros' answer is the great reason). What I'm basically saying is, I'm making up a principle that says there can't be a center of the universe and if that principle is true, the center of the universe can't exist. It's a little tautological, but there is good evidence that the Cosmological Principle is true. We've performed large scale observations of the distribution of galaxies and matter throughout our universe and the evidence shows that on large scales, the universe does indeed appear to be homogeneous and isotropic.