The higher the temperature, the faster the molecules are moving. As the air is heated, the molecules speed up, which means they push harder against their surroundings. If the air is in a balloon, heating it will expand the balloon, cooling it will cause the balloon to shrink as the molecules slow down. If the heated air is surrounded by nothing but air, it will push the surrounding air aside. In the free atmosphere, the air's density decreases as the air is heated.
Pressure has the opposite effect on air.
Increasing the pressure increases the density. Think of what happens when you press down the handle of a bicycle pump. The air is compressed. The density increases as pressure increases. Altitude and weather systems can change the air's pressure.