A cat purring might be because it's in a good mood; it's one of its ways of relaxing. Cats may make this sound when they are petted.

It's also possible that they are in pain, and making this sound is their way of relieving pain, because the vibration frequency of this sound helps the cat's bones and muscles heal and promotes physical health.