What are your current system specs and if you are gaming, what resolution and refresh rate is your screen? It might potentially be better for you to upgrade something else, like a graphics card, depending on what you have.
As far as stock performance is concerned, a 9400F should perform quite similar to a 6600K in applications and games that don't heavily utilize more than four threads, as per-core performance should be about the same. Some of the more demanding games do make use of more threads though, and in those, the two additional cores of the 9400F could help. The 9400F is not unlocked for overclocking though, and overclocking the 6600K could get you a little more performance in lightly-threaded games and applications.
Honestly, I probably wouldn't do either. You likely wouldn't gain a lot of performance at most tasks either way. Going forward, the 9400F will undoubtedly stay relevant longer as games and applications become more multithreaded, but it's questionable whether it would be enough of an upgrade over a 6600K to get one now. And as Phaaze88 pointed out, even six cores without SMT might not be an ideal long-term investment, at least for gaming. Something like a Ryzen 3600 could be another option, and I would consider it to be a bit better since it includes SMT to better handle up to 12-threads, but again, it's performance at most lightly-threaded tasks should be rather similar to the 9400F or 6600K, and you may potentially want faster RAM to get optimal performance out of it.
I also can't see buying an overclocking-capable motherboard for a 6600K at this point either, as that platform has limited upgrade options in terms of CPUs it can support, and you will likely want a higher core-count processor eventually if you are gaming.
Rumor is that Intel may be enabling SMT across their lineup for their next generation of processors to better match Ryzen, so you may potentially see better value around this price range next year. Unless you have some immediate need for more CPU performance, it might potentially be worth waiting for a more justifiable upgrade.