This page explains configuring custom '404' page, also called as 'page not found'
Goto 'DetailedPages' sheet in the Google sheet connected to your site
Create a new row and add Column A as "./404" without quotes.
Add Column D with the required html you want to configure for your 404 page. (See sample as below)
<div style="display: flex; justify-content: center;"><img src="https://static.vecteezy.com/system/resources/previews/000/362/681/non_2x/vector-website-error-404-page-not-found.jpg" /></div><div style="display: flex; justify-content: center;"><a href="./"><h2>Go to home</h2></a></div>
4. Select/Add Column F as "Image top & Text bottom"
The setup should look something like below.
Now, for all pages that doesn't exist in your site, the site automatically shows the page you configured from the above steps.