J.R. S. answered 11/18/20
Ph.D. University Professor with 10+ years Tutoring Experience
NaCl is an ionic compound. Na+ Cl- and the IM forces are coulombic forces, ion-ion dipole and is a solid at room temperature because it has a high lattice energy, i.e. very strong forces holding the ions together.
H2O is polar covalent and has a bent molecular structure. It has hydrogen bonding, dipole-dipole and London dispersion as IM forces holding molecules together. It is liquid at room temperature because the IM forces are strong enough that it doesn't volatilize but not strong enough that it is a solid.
CO2 is non polar covalent and has only London dispersion forces as IM force holding molecules together. It has a linear molecular geometry. It is a gas at room temperature because the IM forces are relatively weak and so it can vaporize at room temperature.