In NBA 2K21, you can dunk in the game by using a Dunk Board. To dunk, you must first place your foot on the Dunk Board and then use your body to push off the board and jump into the air. You can also dunk by using a left or right hand dunk.