Air is less dense than water because air molecules are more spread out than water molecules. This is because air molecules are not as strongly attracted to each other as water molecules. The weaker attraction between air molecules allows them to move around more freely, which increases the volume of air that they occupy.
In contrast, water molecules are strongly attracted to each other, which holds them close together. This results in a smaller volume of water for the same mass, making water denser than air.