At this point in time the difference in gaming performance between Intel and AMD is very minimal. You wouldn't be able to tell the difference if you saw two gaming rigs side by side, one AMD 2700X and one Intel 9600K - really the 9900K playing the same exact games with the same GPU. The only way to tell is if you had FRAPS running in the background. That is how far AMD has closed the performance gap with their Ryzen line.
Now to get to your question, the above two posters are correct. The i5 9600K will outperform The 2700X by about 16% overall in most games. In fact the 9600K at the same clock speeds will have the same performance as the 9700K and 9900K in 99% of major game titles as the vast majority of games don't use in excess of 6 cores.
Now to fully answer your question you have to ask yourself two things: 1. Are you going to be doing anything other than gaming on your rig? and 2. Do you want an upgrade path.
1. If you are going to be doing any productivity work, ie rendering, video editing, ect. then the R7 2700X will be a much better value than the i5 9600K as it will have nearly the same gaming experience while providing much better performance in overall productivity. If you stream your game play you will also have better performance with the 2700X. The reason is simple, the 2700X has 8 cores and 16 threads as compared to the i5 9600K at 6 cores and 6 threads.
2. Do you want an upgrade path? Going forward, even if you buy the newest Z390 motherboard you won't have an upgrade path past the current 9th Generation with Intel. On the other hand if you buy a quality X470 motherboard on AM4 it will be supported though 2020. That means realistically you will be able to run a 2700X, get great performance and have the ability to upgrade to Zen2 and possibly even Zen2+. Zen2 has been reported as having ~16% IPC improvement over Ryzen in some tasks and will also support higher clock speeds. With Zen2 AMD will have a clear superiority in IPC over Intel (right now they are just behind, by literally under 5%). What this means is unless Intel finally gets 10nm out at high clock speeds they are going to be outperformed by Zen2 across the board.
If all your doing is gaming you may also want to consider the R5 2600(X). The R5 2600 can be bought for ~$160 or less and can usually be overclocked to 4 - 4.2Ghz. At those clock speeds it will perform in games the same as the R7 2700(X) as again the vast majority of games don't use more than 6 cores. The R5 2600 would provide a very good bang for your buck and you would be on the AM4 platform with the capability of upgrading to Zen2, maybe Zen2+ in a year or two.
There is no upgrade path with Intel's Z390, whatever Intel does next will require a new motherboard, however there is a clear upgrade path with AMD's AM4 which will be supported though 2020.