You are confusing classical mechanics and special relativity mechanics.
In classical mechanics mass is a conserved quantity and energy and momentum are conserved using three dimensional space vectors to describe particles. One gets statistical mechanics and it can be shown that thermodynamics emerges from statistical mechanics.
Heat capacity etc are all within this framework
The $m$ in $E=mc^2$ belongs to relativistic mechanics,is called relativistic mass and is not a conserved quantity, but a function of velocity .
This is not used in particle physics, where at relativistic energies the four vector formalism is used , where the "length" of the four vector is the invariant/rest mass of particles. In systems of particles the four vectors are added, and the mass of the system is larger then the sum of the rest masses, unless everything is at rest.
Einstein's equation gives an equivalent amount of energy regardless of material type. How is this possible?
It is because it is a mass in motion, with velocity v. It is not the conserved mass of classical physics. Given a rest mass of $m_0$ then the relativistic mass depends only on the velocity, and is only useful for computing how much fuel will be necessary to reach a measurable percentage of the velocity of light .
The thermal energy obtained from the heat capacity comes from the potential and kinetic energy of atoms/molecules in the material. Where does the energy in Einstein's equation come from?
From whatever gives it a veloctiy increase to c, rockets for a spaceship.
Are these two energies related? How are they related?
The classical heat capacity and definition of heat are also a function of the collective motions and potentials of all the individual particles entering with their four vectors. The invariant mass of a hot object will be larger than the sum of the invariant masses of the consituents, due to the addition of their four vectors. Complicated to do it in practice :)
Does Einstein's equation somehow include the internal energy of atoms and molecules?
As it includes the sum of the four vectors of the constituents, it does, but it is clearer to use the four vector formalism.
Solving for E, the $pc$ part is the kinetic energy, the energy carried inherently by the rest mass is the second term.