First of all install DDEV: https://ddev.readthedocs.io/en/stable/#installation
Then execute the following commands:
mkdir drupal9
cd drupal9
ddev config --project-type=drupal9 --docroot=web --create-docroot
ddev start
# You might want to change the default branch depending on the version