This is thought to be a type I or type IV hypersensitivity reaction, and is typically a response to a medication like NSAIDs, penicillin, and diuretics.
There's also the possibility that caffeine's diuretic quality can cause dehydration, which can make you feel tired (though some studies have suggested that caffeine doesn't dehydrate us nearly as much as we've been led to believe).