When a person is suspected of doing something that is wrong, they are said to be in "hot water". Why? Did law breakers long ago have hot water thrown on them for their punishment? Were they dunked in hot water?
I am coming more and more to the opinion that it is fruitless to argue, or even speculate, about the "origin" of many idioms.
Obviously we can in principle find out when this expression was first recorded (we may or may not be able to do so in fact). But unless this first occurrence was in a context that makes it clear that the speaker was thinking about, say, cooking, then I suggest that we cannot know what image the speaker had in mind.
And even if that person who first used the expression had a particular image in mind, that doesn't mean that the people who heard it and used it themselves had the same image.
To me, the picture that "be in hot water" suggests is the old cartoon image of the explorer captured by "cannibal", tied up in a huge pot of water. But from the dates given by other replies, I suspect that the phrase is much older than that picture. (I may be wrong: perhaps that image goes back to the fifteenth century).
But that is just my picture. You can hear me use the expression, and understand it, even if you have quite a different picture. I suggest that this has always been the case, and that there is not and never has been a specific concrete image which the phrase recalled.
I would also note that both of the specific suggestions reported in other answers are unconvincing to me, as neither of them accounts for "in hot water".
Edit: the above applies to those idioms which are more or less transparent. There are others which are pretty well opaque (such as "kick the bucket", or "take a rain-check"), and it does make sense to discuss the semantic origin of these. There are no doubt examples which some of us will find transparent and others not.
All, I could find was:
From the book, "A Hog on Ice":
However, I do know for certain that it originated round about the sixteenth century
There's also this explanation, but I wouldn't place too much on it:
One thing's for certain, it has been in used since the early 1500s.
The OED's first citation for hot water in the sense "trouble" is:
Cost me hot water seems to have been a set phrase:
My speculation: maybe hot water was a canonical example of something troublesome to procure (in the days before hot and cold running water)?