If I plug in my iPhone over USB on a life fitness machine I will be able to play media on my iPhone onto the included tv screen (Hulu/Netflix etc).
Should I be concerned that it will install malware on my iPhone or is it safe to use?
Your iPhone should ask whether you want to Trust This Computer if the host being connected to wants to access your data.
You should be relatively safe by tapping Don’t Trust, barring any unknown USB exploits in iOS. This is always the big caveat when it comes to security.
Otherwise the platform doesn’t install anything without your consent. If the cardio machine tries to do that, you will get a popup, which you can always decline.
This shouldn’t keep you from streaming movies onto the screen.
No, this should be perfectly fine. It is no different to plugging your iPhone into a dock, speaker, music system, car stereo, etc.
These types of devices have offered this type of connectivity for over a decade now, originally to support iPods which had extremely high market concentration for a long time (until the iPhone came along).