As mentioned here several times, that major reason is that they don't know the person well enough. We, as writers, want to do a good job, not a lackluster one.
Moral of the story: don't take it personally.
I've only had to turn down people twice in my career as a faculty member.
It is extremely rare for someone to actually write a bad LOR. Lukewarm ones are more common. ie. "spade92 was my student in my rigorous Anatomy class and he received a B"....and that's all!
Only once have I ever written a bad LOR, and that's for someone I felt had no business going to med school. One other time, when I was a postdoc, a woman was a grad student in my lab mentioned that she might ask me for a LOR...this woman was an absolute snake...really vicious. I told her "Of course I can!"
She never asked and too bad; I was looking forward to trashing her.