Each class of orbital (s, p, d, f, g, etc.) is described by a quantum number l, known as the angular quantum number. For each class of orbital, there are 2l+1 types of orbitals. For example, for the s orbital (l = 0), there is only one type of s orbital. For p orbitals (l = 1), there are three types of p orbitals (px, py, and pz). Since each orbital can hold two electrons, you can see why the s orbitals can hold only two electrons, while the p orbitals can hold six.
Based on this information, you should be able to see why the d orbitals can hold ten electrons and the f orbitals can hold 14.