While it is generally true that iPhones have a more secure operating system compared to Windows devices, it is not impossible for iPhones to be affected by malware. There have been cases where iPhone vulnerabilities have been exploited by sophisticated malware campaigns.
Regarding your specific question, if an iPhone has Windows malware on it and you use that iPhone as a hotspot or for internet sharing, there is a possibility that the connected Windows systems could be infected. Malware residing on the iPhone could potentially be transferred to the connected devices through the internet connection.
However, the likelihood of this happening depends on various factors, such as the specific malware on the iPhone, the security measures in place on the connected Windows systems, and the actions taken by the user on the infected iPhone.
To minimize the risk, it is important to ensure that both the iPhone and the connected Windows systems are regularly updated with the latest security patches. Additionally, using reputable antivirus software on the Windows systems can help detect and prevent any potential infections.
It's worth mentioning that while iPhones have had some security vulnerabilities in the past, Apple has a good track record of promptly addressing and patching these vulnerabilities to protect their users.