It’s illegal to download any copyrighted content by using torrenting. If you are using it to download non-copyright files, it’s absolutely legal.