Is it possible to install MacOS Sierra or El Capitan on an external hard drive and boot it from a PC? I tried it out in Virtual Machine, but it was quite slow, and I don't want to risk losing my Windows by trying to install besides it.
For what you want - Xcode - a used Mac mini or used laptop with a broken screen that you screen share/ssh in to seems far better than trying to dual boot and mess with hackintosh. 

You can usually sell a used MacMini for almost what you paid for it, so the cost for three months of getting started is the interest on $400 expense. Used laptops that work and have broken screens or batteries that hold no charge are more in the $85 to $200 range.

It is possible to boot OS X on generic hardware, but this site isn't the place to ask that specifically - but solving your broader problem of developing Xcode and running a PC primarily is certainly worth a quality answer here with options.