Config.php file resides inside the library folder and is used to configure XenForo settings.
The basic code in the file is as follows:
It contains the database connection settings which includes the database name, host (typically localhost), username and password. These settings allow XenForo to communicate with MySQL database to store and retrieve data (aka forums, thread, posts, templates, etc).
When you upgrade XenForo, the config.php file doesn’t get overwritten and so the changes in the config files are preserved across upgrades.
Example of config.php file setting is to enable the development mode.
Checkout the official documentation for all the advance options for config.php file. Apart from the core XenForo other plugins can also offer config.php file settings.