postgresql.auto.conf is a configuration file with the same format as postgresql.conf, but which is located in the data directory and is managed by PostgreSQL itself (via the ALTER SYSTEM command) or client applications (e.g. pg_basebackup in PostgreSQL 12 and later). Normally it should not be edited manually.
postgresql.auto.conf is always evaluated last, so configuration settings stored here will always override settings in other files.
postgresql.auto.conf was added in PostgreSQL 9.4.
The filename is defined in src/include/utils/guc.h as:
#define PG_AUTOCONF_FILENAME "postgresql.auto.conf"
Functions related to modifying
postgresql.auto.conf are located in src/backend/utils/misc/guc.c, in particular:
AlterSystemSetConfigFile()- the underlying function for ALTER SYSTEM
postgresql.auto.conf is processed in src/backend/utils/misc/guc.c, function