Is it possible to place code in the 404.php file which will change elements in the header.php file?
For example, if a 404.php page is loaded, I want the page’s title and description to be filled in with specific values.
However, as it is these values are empty.
Yes, like objects said:
An example of your header.php:
WordPress Hooks are very easy to use
Depends on your header.php. If it has hardcoded title and description then you’re not going to be able to change.
So the answer is really in your header.php of your theme and how it handles displaying the title.
You can use the is_404() function (in your header.php) to test if it is a 404 and display the appropriate title.