I just got the game NBA2k21 from the Epic Games Store. Is there a way to download the game on my Xbox One or do I have to buy it again?
No. You have to buy it new.
The Epic Store is for the PC. If you want to play your game on Xbox One, you'll need to buy it there
Not at all. The stores are independent of each other, so you can't transfer the libraries. Since the Epic Games Launcher is only available on the PC, you can only install the games that you have there.
Microsoft has a similar program called PlayAnywhere, but it doesn't include all games, especially not those in the Epic Games Store.
There's no way to transfer your game data, no. Very frustrating I know. As an active player, I wouldn't recommend buying it on the xbox either. 2k21 is a worse version of the older 2k20. I have both and I regret buying them, which is why I'm sticking with the old game this year. Better hit next year, I hope it will be better then. ^^