It’s said that gas emanating from a graveyard was possessed by the grievances of the deceased and thus became a Pokémon.
When exposed to a strong wind, a GASTLY’s gaseous body quickly dwindles away. They cluster under the eaves of houses to escape the ravages of wind.