I used a dongle before getting a phone, but now use my phone as a hotspot. I don't want my phone to get malware or viruses.
Can my phone get viruses if I use it as a hotspot while downloading torrents?
By just passing (potentially malicious) traffic through, it is very unlikely. After all, routers on the Internet are relaying tons of malicious traffic everyday without getting compromised themselves.
However the danger begins when your computer itself gets compromised from a malicious file downloaded via torrents, and from there the malware on your computer could compromise other hosts on your network such as your phone.
When your phone is acting as a hotspot it's basically just a router connecting two protocols together (802.11 and either LTE or GSM). It's not actually interpreting any of the data passing though, as that would use a lot more CPU and memory. It's literally just passing data back and forth at OSI Layers 2 and 3.
That said, it's no different than other routers on the Internet when it's behaving like this, and all the other routers on the Internet which have malware, viruses, and all sorts of other bad traffic passing through them are not affected, because they are just passing encapsulated packets and not interpreting them.
So any type of traffic passed in this manner, torrented or not, will not infect your phone when you use it as a hotspot.
Content downloaded from the torrent may be or contain viruses and other malware's but torrent itself is not so.
TORRENT is a file extension for a BitTorrent file format used by BitTorrent clients. Torrent files contain text and point out the trackers for a download to begin downloading from distributors (known as seeders) and requesting clients (known as leachers).
I think the mobile wouldn't get infected by merely using it as the hotspot device. The router or any device that routes the traffic is generally not affected by any kind of traffic flowing through it.
Vulnerability for this transport are quite unlikely, which is more than extremely unlikely as for routers because Hotspot is not (pure) routing as other said.
phone's hotspot has a DHCP (super)user program that assigns in the IP/802.11 transport local IP addresses to the potential N wifi clients and dialog with the kernel over EDGE or UMTS or LTE or similar
through a single IP address assigned by the mobile operator.
Once the local IP addresses are assigned, the packet are masqueraded by the kernel mapping N*64k ports to 64k ports (which suffers for example of output source port numbers saturation). That's a bit more processing than routing. This overhead is simply a bit more at risk (of kernel code vulnerability) than a router on internet.
In general I discourage use of client applications that gain risks possibly against art.
One point not covered by the answers so far is that this may depend on how you're using your phone.
If you're using wireless or bluetooth tethering , then as mentioned, its unlikely to be a problem, however if you're using USB tethering then there is more of a connection between the PC and the phone and if the security on your smartphone is configured to trust your PC (e.g. developer tools enabled & USB debugging enabled), it may be possible for malware on the PC to attack the phone.
There are different problems in the question:
That being said I do not want to make confusion between Torrent and malware. Torrent is just a protocol and can be used to download a Linux ar BSD distrib without risk - provided you control the hash of the received file before using it. What is dangerous is to download codecs or other similar tools from uncontrolled sites and use them.
Unlikely, The phone is simply acting as a router and does what a router does best, It's forwarding data between networks.
The phone itself will have a public IP on it(given to you by your service provider), so to an extent it can be attacked because the server/network you are downloading from can identify that public IP. But if you are downloading torrents the only responsibility the phone has is to forward the level 3 packets to your PC. It does not de-capsulate the packet higher than level 3 nor can it run whatever executable or files you are downloading as it would not be storing the packets in order to be reassembled.