Malware and other software infiltrate computer systems either through direct hacking or by the user inadvertentely 'inviting' the hacker. There are now several dozens of Crypto virus out there, just waiting to take over your computer. Some of the latest (at the time of this article) also encrypt the filenames so you have no idea what files are encrypted, all you know is that you have a short time to pay the ransom to get your data back.
There is no guarantee that you will get your data back, even if you pay. These are by no means legit businesses that run this type of scan so there is nothing stopping them running of with your cash as well.