‘On the pan’, American English, appeares to come from ‘panned’ as in ‘panned by the critics’ which means ‘criticised’.
Panned, in turn, comes from the gold-rush, where pans were used to separate ‘good from bad’ - ie to separate gold from rocks and sand.
Thus, the critics separate ‘good from bad’ in their reviews - sometimes ‘panning’ a performance or whatever, - separating wheat from chaff - by criticising it.
Another theory that I quite like is that it comes from the idea of roasting someone - in a pan, or ‘panning them’. The idea of ‘roasting’ someone does exist today in the sense of a long-form critical diatribes made at award ceremonies etc.
I can’t help having a smirkle of a feeling that being ‘panned or roasted’ might originate from a saint, Saint Lawrence, who was martyred by being roasted to death on a griddle, and famously cried out half way through ‘turn me over - for I am done on one side!’
Making him my favourite saint - for anyone who can maintain a sense of humour when being striped up like bacon, can’t be all bad, in my view.
Said comment is also something that a playwright might cry, when being roasted or panned by the critics, don’t you think?
I can’t find any evidence that he is indeed the origin, but he is quite well known.
https://books.google.co.id/books?id=U32YJQHvo5MC&pg=PA122&lpg=PA122&dq=turn+me+over+for+i+am+done+on+one+side+foxes+martyrs&source=bl&ots=vapzzy6E3v&sig=ACfU3U18L6LO6KCQ3KaybTR4a_QhG8D06g&hl=en&sa=X&ved=2ahUKEwipiYvNt-jjAhXTbX0KHe-WCR8Q6AEwEXoECAcQAQ#v=onepage&q=turn%20me%20over%20for%20i%20am%20done%20on%20one%20side%20foxes%20martyrs&f=false
I had an ancient copy of ‘Foxes book of Martyrs’ a thick tome of onionskin paper, full of the deaths of saints, in which St. Lawrence appeared, illustrated on his griddle, if I remember rightly. You can see him at the link above. Appropriately he is the saint to call on, if one is ‘pained’ by anything. So critics, Eve, or women, might like to know that.
Another theory (of mine, I made it up) is that pan could come from ‘pain’. As in ‘she pained him’. Or ‘it pained him to look at it’. See what you think...
https://www.etymonline.com/word/pain