There are two components to the lava lamp. One is wax and the other is water. At room temperature the wax is denser than water and it settles to the bottom of the lamp. When the lamp is heated the wax expands and becomes less dense so it rises through the water until when it gets close to the top it cools slightly, increases its density and falls to the bottom of the lamp again. That in simple terms is how a lava lamp works (I hope, but a physicist might have a different answer!).