So, an example of the type of copying I am referring to is someone giving me a copy of a song
This is most likely a violation on the part of the person who made the copy. You're unlikely to be able to rectify that violation.
or I download it from YouTube
As far as I can tell, downloading content from YouTube violates the terms of service unless you have paid for a premium membership, in which case you already have a license to download the content and put it to any personal use that YouTube's software makes available to you. But you don't have a license to circumvent the technical system that (I assume) prevents you from playing the content using non-YouTube software.
and I want to play it on my stereo system at home privately (not for a public audience). Since I am "copying" the file to a music server, I assume I need a copyright to do that.
You need a license unless the copying is covered by fair use (USA), fair dealing (UK) or a similar exception to copyright. If you have a YouTube premium membership then you already have the license you need to use YouTube's software to play the music on your system.
Note that I don't think simply buying say a CD entitles me to copy that music file to other devices in my house.
In the US, I believe you're wrong about that. As I understand it, you are allowed to copy recordings for personal use. But this understanding is rather old, so the law may have changed in the meanwhile.
Also, not all songs on YouTube can be purchased physically.
If you can't buy a physical copy, and you can't license a particular song through YouTube, you can see whether the song is available through another service. You can also write to the publisher or the copyright owner and ask for permission, but you're unlikely to get much of a response for any music by an established commercially successful musician beyond a pointer to a streaming service.