This is part of Photography 101, and is all about controlling perspective in your images.
Many inexperienced photographers choose focal lengths merely to be able to frame a subject from whatever camera position they feel is convenient at the moment. They probably don't even realize that there is a huge composition advantage in finding a better vantage point for the shot. The reasons are that distance between the viewer (or camera) and subject is what changes perspective and a different angle, combined with a perspective change can potentially make a huge difference in the quality of composition in a photo.
When I am trying to be completely "in control" of my images, I will - when possible - choose my camera position based on what it does to the perspective. Then, and only then, I will choose a focal length to fill the camera’s frame with the intended image.
Here's a simple example of how perspective control can work for you:
Let's assume that you are taking a photo of some friends in a scene that has mountains in the background. You stand 20 feet from the people and view the scene. A 50mm lens will let you fill the frame with the group of people and some of the background quite nicely, so you take a shot. Then you realize that the mountains are rather small in the background.
Back up to to 40 feet (twice the distance) from the group of people and view the scene, you will see that the mountains are now larger relative to the people - twice the size they were before, in fact. However, the people are smaller in your viewfinder. You now need a 100mm lens to keep the people the same size as in the first image, but the mountains now appear twice the size that they were in the first shot.
Why is this? It's because the additional twenty feet that you put between yourself and the people is insignificant relative to the fifteen miles between your viewing spot and the mountains.
When you are closer to subjects, perspective still comes into play. If you shoot a portrait from a location very close to the subject, the nearest objects (a nose, for example) will be larger relative to more distant objects (such as an ear) than they would appear from a greater distance. That is why experienced portrait photographers like to use a little more distance - and thus a little longer lens – than some beginning photographers would choose when shooting conventional portraits. The subject will usually be happier with the perspective achieved by the greater distance.