There’s no way to know for certain how the malware got on your phone, but if it started slowing down after you downloaded something — such as some new, third-party apps — then there’s a good chance whatever you downloaded contained the malware.