This is a classic, if extreme, example of why some audiophiles really prefer discrete sound cards rather than onboard audio.
What is happening is that there is no isolation (or the isolation has failed) between the signal pathways for data and the signal pathways for audio on your mainboard.
When electricity, even miniscule amounts, runs along one pathway and runs parallel to another pathway, sympathetic electrical currents will be created in that parallel pathway. Audio equipment is especially susceptible to this because it eventually converts any digital information into analog, and those random bits of sympathetic current suddenly become audible sounds.
This principle of sympathetic currents is the same thing that works inside a transformer, where coils of wire wound around ferrite cores create magnetic fields which excite electrons within coil of wire around a core which are parallel to the original. The ratio of the number of coils in each wire and the composition of the ferrite (iron) cores allow for control of the output current based on the input current.
If you're just curious, this is the answer.
If you want a solution: More expensive mainboards generally have some sort of correction or isolation structure that prevents most of this cross-talk. Or a $10 soundcard from your local electronics store, simply because it processes the audio signals in a local physically distant (even if only by a few cm) from the electronic noise on the mainboard, will produce a markedly quieter (not quiet, but less noisy) audio signal.