Hey fella,
if you search over the internet then you will see, it happens with the Wordpress itself. this could happen anytime like while updating theme or plugin, third-party plugins, cache plugins, changes in htaccess files, etc.
WordPress is a powerful CMS. Sometimes a slight tweak can make your website inaccessible. Another common problem that most WordPress users face at some point is WordPress posts returning a 404 Error.
Fixing WordPress posts returning 404 error
Usually, in this scenario, a user can access their WordPress admin area, their blog’s main page, but when accessing a single post they get a 404 Not found error. First of all, don’t panic most of the time your posts are still there and completely safe. This usually happens if your .htaccess file got deleted or something went wrong with the rewrite rules. What you need to do is fix your permalinks settings.
I went to wp-admin -> setting -> permalinks and saved it.
voila, it's done.
You can check out these tips too:
https://www.000webhost.com/blog/fix-not-working-permalinks-in-wordpress/
https://fancythemes.com/fix-broken-permalinks-wordpress/