Due to gravity the earth attracts every object which has mass and pulls it towards its center. Then why the water vapor rises upwards.
Water vapor do get pulled by gravity, otherwise the earth wouldn’t have an atmosphere. When you see these gases rise, the density of the air around it is higher than the density of that gas and so the air around it gets pulled “harder” by gravity, causing the gas to rise.
To put it simply, imagine holding and releasing an ice cube under water. The ice cube will slowly rise to the surface. This doesn’t mean that the ice cube isn’t pulled down by gravity, it simply means the density of the ice cube is less than the density of the water surrounding it.