Why my WordPress site was hacked?
Website developers use several "plugins", some of them have security holes which allow hackers to take control of your website. They can then use your website's server resources for a variety of things, such as spamming, attacks against another site, fishing, crypto, etc.
What to do now?
You must first clean the content of the files and secure your WordPress. Hackers usually affect dozens of files by adding a code to them that allows them to access your website again.