By default the container runs as root. You can ask NPM to drop that, and the data folders will follow your own user.
Add two variables with the numeric ids of the user you want. id -u and id -g show yours:
environment:
PUID: 1000
PGID: 1000
The docs say the services then run as that user and group, and that the data and letsencrypt folders get their ownership changed at startup. That is useful when you edit files in ./data by hand, for example the custom Nginx snippets, and you are tired of sudo.
There is a caveat, and the docs name it: on some systems the container then fails to start because it cannot bind port 80. If that happens, remove the two variables and go back to root. Also remember the ownership change is real. Anything else that read those folders as another user may lose access after the first start with these variables, so look at who owns the files first.
Pick ids that exist on the host and own the folders you mount. Numbers that match nobody work too, but then you cannot easily read the files from your own account, which defeats most of the point.
Further reading: Nginx Proxy Manager: Advanced Configuration, On this site: move the Nginx Proxy Manager admin page off port 81, On this site: pin the Nginx Proxy Manager image version, upgrade on purpose, On this site: Guide: put Nextcloud behind Nginx Proxy Manager with HTTPS and the right headers
Going deeper: Guide: fix a 502 Bad Gateway in Nginx Proxy Manager, with a checklist that finds the cause