"Coccum" originally referred to a berry, specifically the kermes berry, which was used to produce a red dye. This berry was also used to symbolize a "small, enclosed space", a concept that eventually evolved into the modern meaning of cocoon.
Therefore, the word "cocoon" has its roots in the ancient world, specifically the Mediterranean region, where the kermes berry was a significant natural resource.