Torrents aren't illegal inherently; the content downloaded are often copyright violations, yes, but using torrenting protocol itself isn't illegal. Most Linux distributions provide a torrent option to download their OS image file.
Torrents are the backbone of a lot of academic research downloads.
They're the absolute best way to distribute neural network weights, or large models used in physical science studies. That or IPFS.
If you use huggingface or dockerhub for anything like this, seriously consider switching, as it will be extremely useful when those centralized systems inevitably fail.