From the Buddhist 《楞严经》: '一丝不挂,竿木随身' — originally 'not a single thread attaches [to one's mind],' meaning a mind free of attachments. The secular meaning 'not wearing a single thread → naked' developed later by taking the image literally.
mistakes
Despite its Buddhist origin about mental detachment, modern usage is almost entirely physical nakedness. Using it to mean 'free of worldly cares' will confuse listeners — use 心无挂碍 or 无牵无挂 for that sense.