The Ultimate Guide to the WordPress functions.php File
If you’ve started building your own theme, or maybe even creating a child theme to customize another theme, then you’ll have learned all about template files and the theme template hierarchy. But what about the theme functions.php file? The functions file is where you put all of the functionality your theme needs that doesn’t relate just to one template, so it isn’t code that outputs just one type of content or content in just one place in the page such as the sidebar or footer.
Source: The Ultimate Guide to the WordPress functions.php File