The idea was originally formulated by physicist James Clerk Maxwell, but it gained controversy because it appeared to violate the second law of thermodynamics. Put in experimental terms, this law states that when hot and cold water are mixed, they will eventually reach an equilibrium middling temperature.
Maxwell proposed that a hypothetical being (later dubbed Maxwell's demon) could separate the water into two compartments and reverse the process, isolating hot molecules from cold by letting only the hotter-than-average through a trap-door between the compartments.
(Link to original paper)
Link to Original Source