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. One gotcha with brightness controls is that in some contexts it could have multiple meanings. It could refer to an multiplier for luminance values, where blacks don't change and all lightness values are scaled proportionally, or it could be additive, where changing brightness also shifts the black point up and down can crush blacks or wash out the scene if set incorrectly.
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). This curve often approximates a logarithmic
y = x^constantfunction, where the constant referenced here may be called the "gamma value".
A gamma curve is a graph of this function. It's curved because the light intensity readings we store in image files is logarithmically related to the actual light intensity. The coordinates of 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 such as the color primaries, white point etc).
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 using a standard
y = x^constant function to do the transform. 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.
Gamma changes the difference between dark and light areas. Decreasing Gamma makes dark areas lighter and light areas darker. Increasing Gamma makes dark areas darker and light areas lighter. It's more akin to contrast than anything.
Brightness decreases the range of lightness without changing the starting dark point. So decreasing brightness simply darkens, increasing brightness simply lightens.
Although a bit old, this question needs a different answer.
Yes, in some contexts Brightness and Gamma are closely related.
Some programs use these terms to make adjustments to how we see an image. Here are just two examples, one is from the GPU configuration panel, and the second of simple Image editing software.
And in this context is very clear why the confusion.
Let me respond to this with some graphs and examples with simple explanations.
A curve is a graphical representation of a relationship, the current value of some set of pixels vs the new value we want those pixels to have, thus modifying the perceived result.
The simplest curve is no change at all. We have the initial values on an X axis, and we have the same value on the Y axis. The resulting graph is a straight line at 45°. (A)
As a reference, I added 4 numbered columns, 2 and 4 are simple gradients and 1 and 3 are the modification when the curve is applied.
As @thomasrutter stated in the other answer, A gamma curve is a very specific type of curve, a logarithmic one. I will skip the technical and physiological reasons but basically is based on how our eyes perceive changes in tone vs the amount of energy used to generate that part of the image.
Note that the black and white points (marked with the dots) stay in the sample place, conserving the darkest and lightest points (black and white points).
This curve has a characteristic of aggressive change in the darker values and less aggressive in the lighter zone. The result is then more noticeable in the dark zone, the shadows of the image than in the lighter ones.
But a simpler approach is made by a "Brightness" slider. The relationship is linear, but brightening an image lifts all values, basically converting the black into gray (D), and darkening the image turns any white also into gray (E).
So, both sliders can brighten or darken an image, but they use different curves.
My recommendation is to avoid using the "brightness" slider and use, either the gamma function or a personalized curve.
Normally when a program has a brightness slider, it comes with a Contrast one.
They work similarly. A straight line. When you increase the contrast you make the "curve" more vertical (F), and when you reduce the contrast you make it more horizontal (G).
Two related topics: The relation between curves and levels: https://photo.stackexchange.com/questions/43824/how-are-the-levels-and-curves-tools-related/131135#131135
And a comparison between gamma and a normal curve: How do levels in gimp work?