"long, narrow projecting strip; something resembling the handle of a pan," 1851, from pan (n.) + handle (n.). Especially in geography, originally American English, in reference to a long, narrow strip projecting from a state or territory interposed between two other states or territories: from 1856, in reference to the spike of Virginia (now West Virginia) between Ohio and Pennsylvania. Florida, Texas, Idaho, Oklahoma, and Alaska also have them.
Meaning "an act of begging" is attested from 1849, perhaps from notion of an arm stuck out like a panhandle, or of one who handles a (beggar's) pan.