In a shell and tube heat exchanger, the working principle involves two fluids at different temperatures. One fluid flows through the tubes, and the other fluid flows over the tubes within a shell. The heat exchange occurs as the hot fluid transfers its heat to the cold fluid through the tube walls. This setup allows for efficient heat transfer and temperature regulation.