The 9900k is very slightly better at gaming (in the majority of games).
If you care about 2 or 3 fps more then get the 9900K.
If you do literally anything else other than game like video or photo editing, streaming, running other programs when gaming, etc. then get the 3900X.