Please follow the guide how to install Drupal 10
composer create-project drupal/recommended-project my_site_name_dir
You need to keep this structure, the "project-root" will be at my_site_name_dir
and your webserver must point to the "web-root" which will be at my_site_name_dir/web
by default, AFAIS you want to change only the directory of the web-root which you can easily do by adjusting the composer.json drupal-scaffold, e.g
"extra": {
"drupal-scaffold": {
"locations": {
"web-root": "web/"
}
},
and adjust the installer_paths accordingly
and make composer install