How viruses began is a whole 'nother topic. There are theories galore. And no one knows which one is correct. One theory is that those transposons mentioned by Roman earlier managed to jump right out of the cell altogether. How? Random mutation. Why? Because they had to. The mutation that occurred demanded it. Remember that enzymes function because of their physical structure. Chemical rules apply and are mandatory based upon the environment in which they take place.