A computer worm is a type of malware that, once it infects a machine, can automatically copy and extend itself to connected devices.
A computer virus is a type of malware that can replicate itself on your computer and spread to other devices.
An ever-present misconception of MacBooks (and other Apple products) is that they're not susceptible to viruses, which is still not universally true.