Although the option to upload a favicon used to be present in WordPress themes as a custom option in the early days, WordPress introduced this feature on a global website level since version 4.3.
Now you can easily add your favicon to any WordPress website regardless of the theme you are using by following these simple steps:
1. Access the customizer screen via Appearance -> Customize, then click on the Site Identity panel.
2. Upload your favicon, as shown in the image below.
Watch the complete process in this short video:
Note: You can read more at the official WordPress article about using favicons