But regardless of complexity of operation, all lifeforms have the basic function to make more copies of themselves. Unless you can think of another reason why a mushroom pops up out of the ground.
I think the suggestion is that viruses could be descended from cellular life, which found a parasitic niche that allowed them to do away with the cellular mechanisms that they could steal from their hosts.
The famous experiment by Sol Spiegelman, in which he supplied a simple virus with everything it needed to replicate itself for free, and then watched it's genome shrink to a tiny fraction of its previous size, could be an elaboration of the original process by which the first viruses evolved from prokaryotic ancestors.
This is all just guessing, though.