First, we need to ask ourselves what exactly do we mean when we say that something is a wave or a particle. Something is a wave when it oscillates through a medium. Something is a particle when it has a definite size and position at a given time in space.
Now, when photons interact with anything (say to excite an electron in an atom), they behave as if they are a particle. Because that electron has a definite position in space, to excite it, the quanta of light must hit it at that exact point.
But, when light travels through space, it does so in a wave, ie. there is an oscillation of its electric and magnetic fields. The photons are no longer like solid particles travelling through space.
Note: This explanation is from a macro perspective of what it means to be "solid" or "hit something". Also, wave-particle duality in matter is ignored.