What do "degrees of freedom" refer to?
To find the number of degrees of freedom of a system, ask yourself the question, &quot;in how many ways can I describe the motion of this system?&quot;
Let us begin with monoatomic gaseous molecules. Visualise them as minute spheres. 
Image source: http://vle.du.ac.in/mod/book/print.php?id=13264&amp;chapterid=29093
Do you think there are any other ways to describe its motion? No, there aren't, but you might argue that it can also rotate about its own axis, so why do we exclude that? If that's the case, refer to this answer (tl;dr: The moment of inertia of an atom about its own axis is negligible due to the extremely small size and can be safely ignored.)
Now, let's switch to diatomic gases:

Source: https://physics.stackexchange.com/a/210955/168273
The diatomic molecule too is free to translate in any three coordinates of space. Also, it can rotate about the two axes perpendicular to the axis joining the two constituent atoms.
Again if you are wondering about the rotation about the axis joining the two atoms, apply the moment of inertia argument here too.
Alternative definition: The number of terms appearing in the energy equation of the molecule is called its degree of freedom.
$$E_\text{monoatomic}= \frac{1}{2}mv_x^2+\frac{1}{2}mv_y^2
+ \frac{1}{2}mv_z^2$$
$$E_\text{diatomic}= \frac{1}{2}mv_x^2+\frac{1}{2}mv_y^2
+ \frac{1}{2}mv_z^2 + \frac{1}{2}I_x\omega_x^2+\frac{1}{2}I_y\omega_y^2$$
where $I$ denotes the moment of inertia about an axis and $\omega$ the angular velocity about the same axis.
Do you see how this agrees with our qualitative analysis? There are $5$ terms in the energy equation of the diatomic molecule and $3$ in the case of the monoatomic one.
But there's a problem, at higher temperatures, under the provision of sufficient amount of energy the molecules can vibrate too, leading to an increment in the number of terms in our energy equation.
From Wikipedia:

The number of vibrational degrees of freedom, or vibrational modes, of a molecule is determined by examining the number of unique ways the atoms within the molecule may move relative to one another, such as in bond stretches or bends. This can be determined mathematically using the $3N-6=n_\text{DOF}$ rule, where $N$  is the number of atoms in the molecule and $n_\text{DOF}$ is the number of vibrational degrees of freedom. Note that for linear molecules, the rule instead becomes $3N-5=n_\text{DOF}$, meaning a linear polyatomic made up of $N$ atoms will have one less vibrational degree of freedom than a non-linear polyatomic with $N$ atoms.

Why are degrees of freedom important in thermodynamics?
According to the equipartition theorem an ideal gas distributes its energy equally in all degrees of freedom.  The average energy of a molecule in a gas associated with each degree of freedom is $kT/2$ where $k$ is the Boltzmann constant and T the temperature.
Task: Use the equipartition theorem to derive the concise internal energy equations for a diatomic and monoatomic gas molecule at low temperatures (i.e. ignore the vibrational degrees of freedom.)
Besides, knowing the degrees of freedom of the gas under investigation, we can find out its approximate molar specific heat capacities $C_p$ and $C_V$ which we often use in our thermodynamics calculations.