How the size of different objects in a photo appear in relation to one another is what we refer to as Perspective.
Perspective is determined by the position of the camera relative to the scene as well as the position of each element in the scene relative to the other elements in the scene. When a camera position produces a perspective that makes an object or scene look different than we might expect it to look we call that perspective distortion. The camera position gives us a view of a scene or object within that scene that is different from what we would normally expect the scene or object to look like as interpreted by our brains when looking at it with our own eyes.
Perspective distortion is kind of a misnomer. There is really only perspective. It is determined by a viewing position of a scene.
In the context of photography perspective is a result of the position of the camera in relation to the scene as well as the positions of the various elements in the scene with respect to one another.
If one takes a photo of a three dimensional cube from a position very close to one corner the nearest corner of the cube appears to be stretched towards the camera. If one takes a photo of the same cube from a much greater distance and a much longer focal length so that the cube is the same size in the frame, the same corner of the cube appears to be flattened.
Image copyright 2007 SharkD, licensed CC-BY-SA 3.0
Many people misunderstand that it is the focal length of the lenses that cause the difference. It is not. It is the shooting position used to frame the cube with the two different lenses. If we had a camera and wide angle lens, both with sufficient resolution, and shot the cube with the wide angle lens from the same position as we had filled the frame with the cube using the longer focal length lens and then cropped the resulting photo so the cube is the same size the perspective would also be the same - the cube would appear just as flattened as when we shot it using the longer lens.
If one takes a photo of a rectangular skyscraper from the sidewalk across a narrow street the top of the building will look much narrower than the bottom. (Unless we were to properly use a tilt/shift perspective control lens or a view camera capable of perspective control movements.) When we view the scene with our own eyes our brain compensates for this difference and we perceive that the top of the building is the same width as the bottom. But when we view the photo we took from the same spot we don't give our brain the same full battery of clues (mainly our stereo vision due to having two eyes) and our brain does not perceive the photo in the same way as it perceived the actual scene from the same position.
The same is true when we take a portrait of a face from such a close distance that the nose looks twice as large as the ears. The nose is so much closer to the camera than the ears are that they appear much larger in proportion to the ears than they really are. When we view another person's face from such a distance with our eyes our brain processes the scene and corrects for the differences in distance between the various parts of the face in front of us. But when we view a photo taken from the same distance our brain lacks all of the clues it needs and can't build the same corrected 3D model in our perception of the photo.
Here's an extreme example of the effect differences in shooting distance have when using different focal lengths to get the same framing from different distances. The change in perspective is due to the change in shooting distance and the different distance ratios between the various elements in the scene and the camera as the camera moves forward and back to preserve framing of the subject at various focal lengths.
Consider what we refer to as telephoto compression:
Let's assume you are 10 feet away from your friend Joe and take his
picture in portrait orientation with a 50mm lens. Say there is a
building 100 feet behind Joe. The building is 10X the distance from
the camera as Joe is, so if Joe is 6 feet tall and the building is 60
feet tall they will appear to be the same height in your photo,
because both would occupy about 33º of the 40º angle of view of a 50mm
lens along the longer dimension.
Now back up 30 feet and use a 200mm lens. Your total distance from Joe
is now 40 feet which is 4X further than the 10 feet you used with the
50mm lens. Since you are using a focal length that is 4X the original
50mm (50mm X 4 = 200mm), he will appear the same height in the second
photo as he did in the first. The building, on the other hand, is now
130 feet from the camera. That is only 1.3X as far as it was in the
first shot (100ft X 1.3 = 130ft), but you have increased the focal
length by 4X. Now the 60 foot tall building will appear to be roughly
3X the height of Joe in the picture (100ft / 130ft = 0.77; 0.77 X 4 =
3.08). At least it would if all 60 feet of it could fit in the picture, but it can't fit at that distance with a 200mm lens.
Another way to look at it is that in the first photo with the 50mm
lens, the building was 10X further away than Joe was (100ft / 10ft =
10). In the second photo with the 200mm lens, the building was only
3.25X further away than Joe was (130ft / 40ft = 3.25), even though the distance between Joe and the building was the same. What changed
was the ratio of the distance from the camera to Joe and the
distance of the camera to the building. That is what defines
perspective: The ratio of the distances between the camera and
various elements of a scene.
In the end, the only thing that determines perspective is camera position and the relative positions of the various elements of the scene.
For a look at how even a fairly slight difference in perspective affects an image, please see: Why is the background bigger and blurrier in one of these images?
This has all been well covered here before.
Why is the background bigger and blurrier in one of these images?
What does it really mean that telephoto lenses "flatten" scenes?
What is background compression?
Does wide angle equivalent in crop sensor skew image?
Is there a difference between taking a far shot on a 50mm lens and a close shot on a 35mm lens?
How does focal length change perspective?
What is the difference between perspective distortion and barrel or pincushion distortion?