When you lit the candle the first time you did it in an area where the air pressure was constant, so the smoke flowed straight up. When you set the pans side by side, the ice cooled the air around it, creating a mini high-pressure zone, and the sand warmed the air around it to create a mini low-pressure zone. Air always flows from a high-pressure zone to a low-pressure zone to even up the pressure. You made a tiny breeze between the pan of ice and the pan of sand, and the smoke floated sideways in the breeze. The same thing happens between cold ocean water and hot beach sand.
Air pressure changes cause wind, but they are responsible for other types of weather too. A low-pressure zone usually causes clouds and rain, because as the hot air rises it carries with it evaporated moisture that can condense into clouds. A high-pressure zone usually results in clear skies and sunny days because sinking currents prevent moisture from rising up and forming clouds.