Density
Whether something sinks or rises in water is determined by its density. If something is more dense than the surrounding water it will sink. If something is less dense it will rise and float. The trick behind a lava lamp is that the waxy compound has almost exactly the same density as the water inside the lamp, and this density changes with temperature. When the wax is cool, it is slightly more dense than the water and it sinks. When it’s warm, it gets less dense, and it rises.