Your camera has a sensor with a mask of color filters over each pixel well (more properly called a sensel). For the vast majority of cameras every other sensel following a checkerboard pattern from line-to-line is filtered for green light. Green is the color in the middle of the visible spectrum that humans are most sensitive to. The remaining half of the sensels alternate between red and blue filters. Each sensel records a single brightness value for the light that made it to the bottom of the pixel well. For a very detailed answer that explains how a color image is created from a single brightness value for each sensel, please see this answer to RAW files store 3 colors per pixel, or only one?
What we call white balance boils down to how much the signal from the green, red, and blue filtered sensels respectively are weighted compared to each other when the camera (or a computer based raw convertor) converts the information from the sensor into a color image.
The reason a camera can't just always use the same weighting is that the color of various light sources are different. Our eyes and brains usually compensate for these variations in the color temperature and white balance of different light sources. Our cameras need a little more guidance. If the camera is set to 'Auto WB' it will use the information it collects in the scene to guess the correct setting. The most basic cameras usually do this by assuming the brightest thing in the picture is white. Modern cameras have become very sophisticated in the ability to guess correctly most of the time. But certain scenarios are still difficult for them to interpret properly. Thus, cameras also give the user the ability to set the color temperature and white balance manually.
Please notice that we use both the terms color temperature and white balance. Color temperature is one part of white balance, but white balance is more than just color temperature. We express color temperature in degrees Kelvin along the scale of the color emitted by a black body heated to a certain temperature. That is but one axis that runs from one side of a color wheel to the other. It is a very important one because natural light sources tend, for the most part, to also run very close to that axis. But there are other axes, particularly the magenta←→green axis, that are also a significant part of the white balance adjustment.
For an extreme example of how proper white balance, particularly along the magenta←→green axis can affect the color (and more) of a photo, please see this answer to Blown out blue/red light making photos look out of focus (Several example images are included in the answer)
For more on how to set fine adjustments of white balance beyond color temperature in-camera (or, with many cameras, even when using AWB) please see: How to cancel purple stage lighting on subjects? (several example images are included in the answer)
Note that if you shoot raw files white balance will not be applied until you process the raw data using a raw convertor. Whatever CT and WB is set in camera will only affect the jpeg preview image that is generated as part of the raw file. That preview image is what you see on your camera's screen when saving your images as raw files. Also note that the in-camera CT and WB settings may be ignored by some raw conversion applications (most notably Adobe Camera Raw/Lightroom/Photoshop). Most of the various manufacturers' own raw convertors will open images with the in-camera settings applied to the raw data of images created with one of that manufacturer's cameras. In either case, you are free to adjust the settings to change the CT and WB to whatever you wish.
With jpegs produced in-camera, the white balance is more or less 'baked in.' Although you can alter the saturation and response curves of the three color channels individually, you don't have near the flexibility with jpegs as you have with raw files because you no longer have all of the data contained in a raw file when working with a JPEG derived from that raw data. You can see a side-by-side comparison between the adjustments that can be made to a JPEG and to a raw file of the same image shot under less than ideal conditions at a hockey arena in this answer to Lots of noise in my hockey pictures. What am I doing wrong?