In the past, it was mostly curiosity and street cred. But viruses and malware have become businesses and the current trend in the malicious hacking community is toward profit as a motive.
Now they'll do things like encrypt your documents and photos and make you pay them a small amount to get access to them or they'll delete them. Or they'll take over the computer in order to use it to send out spam.
There are still hackers doing it for fun, but the overwhelming majority of it these days are automated bots in botnets run for profit.