不由自主 emphasizes loss of bodily or emotional control — your actions happen against your will. Compare with
不由得, which is similar but often describes a mental reaction (can't help thinking/feeling), while
不由自主 more often describes physical reactions (body moving on its own).