Photography takes an instant out of time, altering life by holding it still.” - Dorothea Lange
To take a well exposed photo, you need to balance aperture, shutter speed, and ISO.
In Aperture Priority and Shutter Priority modes, you control of two of these settings either aperture/ISO when in Aperture Priority or shutter speed/ISO in Shutter Priority.
Your camera will take care of the third setting for you. However, if you are using manual mode, you are in charge of all three.
If your photos are coming out too dark, then you need to use a wider aperture (smaller f-number), slower shutter speed or higher ISO to brighten them up, whereas if your shots are too bright you need to use a narrower aperture (larger f-number), faster shutter speed or lower ISO to darken them.
All three settings work together, so if you change one, then you will also need to change the others to correct the exposure. Think of it like a scale if you remove light from one side of the scale then you have to add light on the other side to balance the scale out.
For example, if you change the aperture (e.g. go from f4 to f2.8) then you will need to make the shutter speed faster (e.g. from 1/500 sec to 1/1000 sec) to record the same amount of light.