You need to swizzle the component and customize it as stated here.
Run:
yarn run swizzle @docusaurus/theme-classic NotFound
I've used eject mode, which creates a copy.
And then edit the src/theme/NotFound.js file.
To see which components can be modified run the following:
yarn run swizzle -- --list
