Coconut oil does go bad eventually.
Once you open a jar of coconut oil the opened jar of coconut oil lasts around 2 years before it goes bad and should be thrown out.
If the coconut oil jar has never been opened then it can last up to 5 years or even longer.
If you open the jar of coconut oil and it smells bad or has any mold or changes to it then throw it out.
Bad coconut oil if ingested could make you sick so throw it out to be safe.
But even when it's expired coconut oil is still okay as long as it doesn't smell bad or have any mold or other issues with it.