The old definitions of malware have been blurred over the years, and the strict usage of terms is ignored as often or not. But originally malware was often categorised by the manner of its operation based upon the similarity of its operation to pathogens in biology. So a computer virus should operate in a similar manner to a biological virus. This requires that it inject its code (aka DNA) into the code of an application (ie a cell’s DNA) and that it should operate as a malicious component of that application. It hijacks the operation of the program it its own ends - just as a biological virus hijacks the DNA of a cell. Strict definition does not allow a virus to be a stand alone program. That is typically termed a worm. Worms infest your computer as standalone programs, and do not depend upon the activation of an existing program to operate. Just as a worm is a separate biological entity that simply resides within you. Either can replicate.
The wide range of malware, and sophistication of operation, tends to render the simple taxonomy of operation somewhat obsolete. Some malware can exist in both states, and other states that arguably call for further biological analogues.
The manner of infection is another issue again.