How did viruses learn to utilize the workings of a cell?
It's a numbers game.  Viruses can produce thousands, millions, even billions of copies every day, and only one of them needs to be slightly better to get ahead.  Rhinoviruses make roughly one error every time the genome is replicated; over many, many replications a single change can arise giving an advantageous effect.  As another example, it's been said that HIV mutates every single spot on its genome every single day.  Evolution is simply a waiting game.

This article is a pretty cool write up detailing the process.  It says exactly what I said: large numbers, high mutation rate.  Besides, the virus only has to take advantage of cellular processes, not make new ones every time.  That's much more efficient.  It also details some specific changes that explain some differences between similar viruses.  It's amazing, but a single base change can mean a single protein is different which can mean a different receptor is used for binding, which can make all the difference.

And there's this cool quote:


  [T]here may well be more viruses in a single common cold infection than there have been primates in the entire history of life on Earth.