Not covered in any of the other correct answers (although alluded to in the comments), this can also be a compensation at a subconscious level for the artificiality of the tempering process.
The natural scale is formed by mathematical relationships between the frequencies of pitches. But all natural scales are formed in relationship to a single root note, and are therefore "attached" to a single key. To make instruments more flexible and able to handle multiple keys and key changes, a technique called "tempering" was invented. This tweaks the notes of the natural scale to slightly different notes that sound almost the same. Now, instead of having a piano in the key of A or the key of C, you have a piano that handles all keys in the chromatic scale.
This flexibility, however, comes at a price. There's some reason to believe that people are subconsciously aware the intervals are just slightly off. For that reason, some musical styles, such as blues and jazz, use pitch bending, grace notes and accidentals to suggest notes closer to the natural scale tones. (If this interests you, I have an essay on the topic here.)