Because for microscopic, quantum systems, "behave as" is equivalent to "which kind of measurement apparatus + quantum system to measure, we are using". If the measurement apparatus is able to precisely register the position of the quantum system, then the quantum system (light, in this case) behaves as particle; if it doesn't, the quantum system behaves as wave (this over simplifying a lot).

As you see, it doesn't depend on the quantum system *only*, but on the measurement apparatus too.

Let's make a metaphor: if you ask to a person which film he/she saw at cinema, he/she probably won't have problems in telling you the truth; if you ask him/her if he/she has made a crime, it won'y probably tell you the truth (in case he/she has). The person's behaviour depends on the asker's question.