The aperture controls the amount of light that passes through the lens and falls on the sensor. It is essentially a variable size hole. A large hole allows more light get through. A small hole lets less light get through. The aperture settings are commonly called F-stops and have an associated number like f/4 or f/16. Here’s the confusing part, larger numbers indicate a smaller aperture opening and smaller numbers indicate a larger opening. So f/4 would be a wide aperture (big hole) and f/16 would be a much narrower aperture (small hole)
Beyond the amount of light that is allowed to pass, aperture has another affect on the image. Aperture controls the Depth of Field (DoF). Depth of Field is how much of the scene is in sharp focus. Using a f-stop like f/16 (small hole) will render more of the scene in focus and an f-stop like f/4 (large hole) will render less of the scene in sharp focus.
There is no right or wrong Depth of Field, it’s a matter of choice. However, landscape’s are often shot with a narrow aperture so that the foreground, middle and background are all in focus. A portrait, however, might be shot with a wide aperture so that the subject is in sharp focus but the background is unfocused and indistinct. The purpose is to make the subject more prominent.
Some lenses are capable of very wide apertures like f/1.4. The Depth of Field at f/1.4 can be so narrow that the subjects eyes might be in sharp focus while the ears and the tip of the nose are soft.