I use both virgin coconut oil and ghee (clarified butter fat) for cooking. Both have fantastic nutritional benefits, so I like to mix it up as much as I can.
Coconut oil is available as virgin or refined. I use the unrefined virgin oil. It retains the natural nutrients and taste fantastic, even right off of the spoon. One of the benefits of refined coconut oil is that it has a slightly higher smoke point since many of the 'impurities' (if that's what they wanna call it) have been removed. I find that interesting, because all the brands of virgin coconut oil I have used taste perfectly pure and melt to a crystal clear water appearance. You would think that cooking in coconut oil would taint the food too much with flavor. Surprisingly, it doesn't. Eggs taste amazing in virgin coconut oil. So do vegetables and meats. To answer the question directly though, refined is not bad for you. But unrefined has many additional benefits that you wouldn’t want to miss out on.
Butter is ok to cook in, but as mentioned in other comments already, the smoke point is lower because of the milk solids. For low to med heat, butter is fine, but you can't cook with it for long periods of time on high heat, or it will eventually burn. This is where ghee comes into play. What a Godsend! Homemade ghee is extremely easy to make, and the cost is cheaper than a quality virgin coconut oil. It is literally just the cost of butter. Personally, I'll go buy 2 pounds of grass fed pasture butter for $10 specifically to make ghee. All you do is melt it in a sauce pan over low-med heat. It takes about 15 minutes before the milk solids completely separate and rise to the top. Scoop off the foamy solids with a spoon and discard it. Do this until all you have is the oil in the pan with some solids at the bottom. It will be bubbling. Let it simmer on low until the bubbling subsides a bit. Turn off the heat and let cool. Pour through a strainer or cheesecloth into a jar and voila! Homemade grass fed ghee! What are the benefits? A very high cooking temp smoke point. You can literally fry things in ghee and take comfort in the fact that the oil is nutritious butter fat and a highly stable saturated fat. The ghee flavor is much more subtle than butter, but still very delicious. Also, ghee doesn’t splatter as much as other oils. It doesn’t make a big mess on your stove or in your oven.
I switch back and forth between coconut oil and ghee, and use only these oils exclusively to cook with.