I find that the best way to make aperture-setting selections stick in your mind to be able to achieve a desired effect is to shoot sample images at two aperture extremes. Start by putting your camera into the aperture-priority mode (A on Nikon cameras; AV in Canon cameras). Then set your aperture to the widest setting (like F/2.8, F/3.5, etc.) and take a photo. This will be your sample A (see my sample below). Then move your aperture to its smallest setting (like F/22, F/32). This is your sample B. Then study the difference between the shots.
Now, to make things confusing, your results will vary depending on your widest aperture setting, focal length setting and how close you are to the subject. In my sample shots above, I was very close to the flowers I focused on and my aperture was F/2.8 in the first, so the brick building in the background is out of focus perhaps more so or less so than your sample shots may show.
If you keep making samples for yourself like this, eventually it will become second nature when you are shooting to select the appropriate aperture to get the photo you have in mind (with out of focus background or sharp background).
Typically you will want to blur the background a little for portraits for a more professional look; or if the background is very distracting; or if you want the viewers of your photos to be drawn to so a very specific part of the shot.
Photographers will use a smaller aperture to get the foreground to background in focus for landscapes, and sometimes for shots that tell a story of where you are. For example, you may want a store name to be in sharp focus so that it is legible. Or you may want the details of a landmark to be in sharp focus as well as your family standing in front of it.
However, sometimes landmarks, such as the Disney Castle, are so recognizable, that having the castle slightly out of focus works really well to give you a “here we are” shot that is elevated to a more professional looking image. Below is a sample from Epcot’s China Pavilion.