Were you trying to use coconut oil as a hair mask, or an overnight treatment, or...? And then you just forgot to wash it out after?
Maybe try soaking your hair in hot water (as hot as you can tolerate) and then attempt detangling (starting with your fingers). My thinking is, since coconut oil solidifies at a certain temperature, getting it to a liquid consistency using hot water may help. And if that happens to work, wash your hair (do it multiple times if you need to). Don't attempt a coconut oil treatment again for a while.