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.
Have you checked Wikipedia?
The oldest known source, but questionable explanation for the expression "baker's dozen" dates to the 13th century [...]. Bakers who were found to have shortchanged customers (some variations say that they would sell hollow bread) could be subject to severe punishment. To guard against the punishment of losing a hand to an axe, a baker would give 13 for the price of 12, to be certain of not being known as a cheat. [...]
Best Answer
Some claim they originated in the Middle Ages as a call-and-answer password format. Others, as @Callithumpian notes, cite passages in Shakespeare.
Here is a legitimate reference to their existence in America in 1936:
This is the first legitimate printed reference I can find.