Fog is usually there to hide something or to make a game look more realistic.
Let's go way back, to the days of the first Silent Hill game. This is a very known tale alreadx so I keep it short. The developers had FPS issues when they tried rendering the game, so they had to take the view distance shorter. This made the game have a noticable cutoff, so to hide this, they added fog, which made the game have that eerie feeling it's known of. This is not the first use of fog, but it's a pretty know one.
Fast forward 10 or so years, and the fog's purpose is still the same, but rather than hiding a cutoff point, it hides things such as changing from models to billboards (which can't be hid any other way), straight up using 2d images instead of models for distant object you can't get to, and LOD changes. If you look at the Breadth of the Wild images, you can notice this. The terrain in the background is far less detailed and has a bad texture on it.
Fog can also add realism to the game, it can obviously symbolise weather and make the player a bit more freaked out.