That's the old "picking up internal PC electrical noise" problem. There is no fix that always works. You can try isolators and such but all this has been discussed for decades.
My advice is to use speakers that work since most folk don't have electrical or electronic design background to tinker and try to fix it. Even I don't fix these as the time is usually lost half the time. I find it more productive to use speakers that work without the headaches.
I have a very loud electrical noise issue when connecting my motherboard audio to my powered monitor speakers.
My speakers are Yamaha MSP 5 Studio and my motherboard is Aorus Z390 Master.
The very strange thing is that they both work perfectly otherwise, the only problem i encounter is when I connect theese certain speakers to my motherboard.
I have connected multiple headphones/speakers to my mobo and they work perfectly
I have connected multiple devices to my speakers and they work perfectly.
I have also tried about 15 different cables.
I am literally broken at this point and I don't know what to do anymore.
I have made a video showcasing the problem that I have.
View: https://www.youtube.com/watch?v=nW64NDYiJag
I tried every setting in bios and I have tried every setting in windows since this issue appears only when I open up windows as shown in the video.
I am almost certain that it is an mobo issue since the speakers worked perfectly until I connected them to this mobo also they are 2 so the chance there is something wrong with both of them is really low.
My opinion is that the noise is the type of noise that headphones make when the impedance is too high and this motherboard has an integrated amp while other devices only have a DAC.
I think that the motherboard does not recognize that the monitors are self powered and tries to amplify them as it would do to a pair of headphones.
I think that what I need to do is disable the motherboard amp somehow but I have looked throughout every bios setting and read the user manual thoroughly.
I am desperate and willing to try anything any help would be appreciated thanks !

Chowhound
Comic Vine
GameFAQs
GameSpot
Giant Bomb
TechRepublic