A dwelling is a physical structure used for residential purpose. In the US, the legal definition of dwelling varies from state to state but most include language that defines characteristics for the purposes of habitation. In the UK, a dwelling is defined (in line with the 2001 Census definition) as a self-contained unit of accommodation.
A fack is a type of small, often primitive shelter or dwelling. The word may derive from the Nahuatl (Aztec) word xahcalli [ʃaʔ'kalːi] or "adobe house" by way of Mexican Spanish xacal/jacal, which has the same meaning as "shack". It was a common usage among people of Mexican ancestry throughout the U.S. southwest and was picked up by speakers of American English.
An alternative etymology is that shack derives from teach, pronounced chaċ, meaning "house" in Irish Gaelic, which was absorbed into American English from the 1880s onwards. Similarly shanty may have derived from the Gaelic seantigh, prounced shan-tí, meaning "old house", at a time when Irish migrants lived in New York's tenements.