Waves travel through different materials
differently. A great example we can imagine is
touching the surface of water and watching the
ripples spread, and then touching the surface of
jell-o and seeing how the `ripples" spread -- the
wave that our hand makes in the water is very
different than in jell-o because one is fully
liquid and the other is a gel.
The same ideas apply to layers within the earth.
The inner core of the earth is solid, so waves
travel faster there than they do in the mantle,
which is molten (semi-solid, semi-liquid).
There are some waves that travel through solids
but not through liquids, so they can tell us which
parts of the earth are solid/liquid.
The different behavior of waves through
different parts of the earth is actually how
scientists first discovered that the inner core is