I don’t know anything about live-streaming in a browser to YouTube. Google isn’t especially good in its software support of Apple hardware.
there appear to be lots of apps for streaming from iOS so maybe that would be easier to figure out than macOS.
Why not? It has a camera. Just need to find an app that supports the iMac camera.
https://support.apple.com/guide/mac-help/use-the-built-in-camera-mchlp2980/mac