Is there any difference between these two terms, or they describe the same thing?
They are two distinct terms – they aren’t related.
Brightness is a general term for the intensity of light: how “bright” something is. It’s not a particularly technical term, but in context it could stand in for “intensity” of light, for example.
Gamma is a more technical term for describing the mathematical formula for converting a stored luminance value (say, in an image file) to/from a raw light intensity value (say, in a monitor, scanner or camera). A gamma curve is a graph of this function. It’s curved because the light intensity readings we store in image files is non-linearly related to the actual light intensity – in fact it’s logarithmic. The curve itself, or some coefficients to a function describing the curve, are contained within a colour profile (although a colour profile also contains other information).
Here is the gamma curve for the sRGB colour profile (it’s shown here compared to the function
y = x^2.224, a very close approximation). sRGB is a very common colour profile – the profile used by default on the web and by the images output by default on most cameras and scanners. Part of the sRGB colour profile is describing how raw light intensity values are converted to the values that are stored in the image file. They follow this gamma curve.
The “curves” command in Photoshop or GIMP can be used to apply any arbitrary curve function to the luminance values in your image. This is sometimes casually referred to as “adjusting the gamma”, especially when the curve approximates a logarithmic
y = x^constantfunction. Some things like the settings in your TV might have a “gamma” adjustment, the purpose of which is simply to apply such a curve to the luminance values throughout the image.
Applying such an adjustment has the effect of lightening or darkening mid-tones while keeping the black point and the white point the same. This is often described as having the effect of “boosting shadows” if the mid-tones are boosted.