In thermodynamics, free energy is a measure of the amount of work that can be extracted from a system. In this sense, it measures not the energy content of the system, but the "useful energy" content.
In different situations, free energy is related to internal energy in different ways. For instance, in chemistry one is usually concerned with fluid systems at constant temperature, undergoing chemical reaction in closed containers (at constant volume) or in open containers (at constant pressure). In the first case one would use the Helmholtz free energy as a measure of available work, and in the second one would use the Gibbs free energy. Physicists carry out more abstract analysis of systems which are not necessarily fluid. In that context, the Helmholtz free energy is more common, and it is also directly related to the partition function of a canonical ensemble in statistical mechanics. In the isothermal-isobaric ensemble, the partition function is related to the Gibbs free energy. For this reason, there is some confusion in terminology, which we disentangle below.
The usage in physics and chemistry is as follows: