There are a TON of 'origins' of the term 'shanty', 'shantey', 'chanty' whatever.
Ones I've heard - "Shanty" as a corruption of "Shandy", a drink sailors were fond of. "Shanty" from the tumbledown shacks sailors would often be forced to live in during the 'off' seasons (esp. common in whaling, from what I've read). "Shanty" from the influence of slaves, again from the buildings they at times lived in. "Chantey" from the French. "Chantey" or "Chanty" from a corruption of "chant", as in the work chant. Many, many others - probably many other potential definitions for each spelling, and many spellings that are 'good' to SOMEONE.
Most of those still have their supporters and detractors. Fact is, most any of the 'major' variants are accepted. There is no conclusive evidence that sets ANY of the variants apart as the 'true' way to say/spell the word nor the origin of it.
M