Where does the expression “to pull chestnuts from the fire” originate and What does it mean?

The expression “to pull chestnuts from the fire” means: To be made a cat’s-paw, to be used for the advantage of another.

The story dates back at least to Pope Julius II ( 1503-1513 ) who, some say, owned the monkey of the tale. As related by Drexelius (in Latin, translated for me by Miss Phyllis L. Bolton), it reads:

I am told by an excellent and reliable man that there once was a monkey who, because he was a favored pet, ran free about his master’s house. One day a soldier stood outside hungrily gazing into the kitchen. The cook pretended not to see him and failed to make the customary offering. Seeing his hopes frustrated, the soldier slipped into the kitchen and, the moment the cook disappeared, stepped to the hearth. As it happened, there were chestnuts roasting on the hearth and their fragrance, which had attracted the hungry watcher, was equally alluring to the monkey. He, too, was drawn to the fireplace where he beheld the cause of the enticing aroma and endeavored to pull them out of the coals. Failing sadly, unable to stand the heat, the monkey snatched back his singed fingers. At a loss what to do then, he sat scratching his head. Suddenly his eye fell upon the cat lying in wait for mice. In an instant he pounced upon her and forced her, struggling and spitting, to serve as his deputy. Seizing the cat’s paw in his, he used it to draw one chestnut after another from the fire. The cat did not, naturally, take such servitude kindly, and back arched, fur on end, she howled piteously until her wails brought the cook to the rescue.