What is the origin for the idiom "a hot potato"? I know previously hot potatoes were used as hand warmers but I don't understand how that fits the meaning of the idiom.
Hot potato -- Dictionary
(informal) a situation or issue that is difficult, unpleasant, or risky to deal with.
From the same page, you'll find the origins explained (emphasis and links mine):
This term, dating from the mid-1800s, alludes to the only slightly older expression drop like a hot potato, meaning “to abandon something or someone quickly” (lest one be burned). The idiom alludes to the fact that cooked potatoes retain considerable heat because they contain a lot of water.
As a supplement to NVZ's explanation of the sense of the idiom, I note these early instances of the longer form "[drop] like a hot potato." From Joseph Donaldson, Recollections of an Eventful Life: Chiefly Passed in the Army (1824):
I attempted to help myself to some corn, which was lying in a basket.—"Drop that like a hot potato," said one of the Connaught Rangers. I tried another basket, but it also was appropriated ; and, as there were none of my regiment there, I could not expect to succeed by force ; so I left the place, sorrowful enough, on my way back to the picquet, with a cargo of cold water, poor cheer, certainly.
From "Louisiana Election," in the [St. Johnsbury, Vermont] Caledonian (July 17, 1838):
The whole number of votes polled the first day in New Orleans, was 992. The American says:
In the first municipality 504 votes were taken, a majority Whig. Slidell, we understand, was dropped like a hot potato.
In the 2d municipality, owing to the purposely slow mode of the judges in receiving the votes, but 251 were polled, but they were pretty much all Whigs.
From W. M. Thackeray "Loose Sketches: Rolandseck," originally in The Britannia (June 19, 1841):
"My lord," said the nurse, dropping a curtsy, "it's a dear little darling, sure enough—sure enough; but it's a girl!"
"A what?" roared the baron, dropping the innocent thing as though it had been a hot potato—not a lovely smiling infant. "Fiend! unsay the word;"—but, of course, the nurse could not unsay the word, and ran off with the baby in the greatest fright in the world.
From the [Fayette, Missouri] Boon's Lick Times (April 29, 1843):
The last "Jefferson Inquirer" we notice, has adopted the "Democrat's" style of arguing. The conductors of those papers are something like a species of animal found in our country; work with it gently, and all goes well—but the moment you press it, one's olfactories are affected in such manner as to cause it to be "dropped like a hot potato."
From "Tom Duncan's Yarn," one of the Tales of the Borders, in the [Launcestown, Tasmania] Cornwall Chronicle (September 18, 1844):
As soon as the pirate captain seed him [a young fellow], he ran at him like a tiger, and, seizing him by the throat, shouted out—"Dead men tell no tales," and raised his tommyhawk to cleave him to the skull. Poor lad! he thought his signal for sailing was made, that it was all up with him. He muttered 'Mercy, mercy!' But poor mercy would he have met with, if I hadn't run up just in time, and fetch'd the fellow a slash with my cutlash, which made him drop the tommyhawk like a hot potato.
From Master Harry, "Elk Shooting on the Ceylon Mountains," in The Sporting Review (October 1845) [combined snippets]:
Having waited for half an hour in vain, we left our hiding place, and perceived in the hollow below us two elks, apparently admiring the prospect before them. The ground between myself and the animals would in cold blood have been deemed impracticable by any one not insane, but taking care not to endanger my gun, I dropped myself "like a hot potato" on the nearest landing place, some fifteen feet below where I stood, thereby contracting a bloody nose and a sprained ankle; notwithstanding which I managed by alternately crawling, tumbling, and jumping, to come at last within shot of the elk, who were standing almost perpendicularly beneath me.
Of these, early instances the first is from Britain, the second from the United States, the third from Britain, the fourth from the United States, and the fifth and sixth (originally) from Britain. From this record, it is difficult to say whether the expression originated in Britain or the United States, although the former seems somewhat more likely—but in in any event it spread widely and rapidly between 1824 and 1845.
The term came about in the 1800's. Potatoes retain heat well because they hold a lot of water. So, if it was too hot you would drop it. Also potatoes are plentiful. You get one and cut it into fours. Then you have four so it was an idiom all could recognize, and it stuck.