Sun's power density compared to a compost heap
Your (gardener's) intuition is wrong. If you increase the size of your compost heap to the size of a star, then its core would be as hot as that of the Sun. All other things being equal (though compost heaps are not hydrogen plus helium), the temperature of a spherical compost heap would just depend on its total mass divided by its radius$^{*}$.
To support the weight of all the material above requires a large pressure gradient. This in turn requires that the interior pressure of the star is very large.
But why this particular temperature/density combination? Nuclear reactions actually stop the core from getting hotter. Without them, the star would radiate from its surface and continue to contract and become even hotter in the centre. The nuclear reactions supply just enough energy to equal that radiated from the surface and thus prevent the need for further contraction.
The nuclear reactions are initiated once the nuclei attain sufficient kinetic energy (governed by their temperature) to penetrate the Coulomb barrier between them. The strong temperature dependence of the nuclear reactions then acts like a core thermostat. If the reaction rate is raised, the star will expand and the core temperature will cool again. Conversely, a contraction leads to an increase in nuclear reaction rate and increased temperature and pressure that act against any compression.
$*$ This relationship arises from the virial theorem, which says that for a fluid/gas that has reached mechanical equilibrium, that the sum of the (negative) gravitational potential energy and twice the internal kinetic energy will equal zero. $$ \Omega + 2K = 0$$
The internal kinetic energy can be approximated as $3k_BT/2$ per particle (for a monatomic ideal gas) and the gravitational potential energy as $-\alpha GM^2/R$, where $M$ is the mass, $R$ the radius and $\alpha$ is a numerical factor of order unity that depends on the exact density profile. The virial theorem then becomes total kinetic energy $$ \alpha G\left(\frac{M^2}{R}\right) \simeq 2\left(\frac{3k_BT}{2}\right) \frac{M}{\mu}\ ,$$ where $\mu$ is the mass per particle. From this, we can see that $$ T \simeq \frac{\alpha G\mu}{3k_B}\left( \frac{M}{R}\right)$$
Another way of seeing that the Sun's power density must be rather low (or that very large compost heaps get very hot) and also to see the temperature-radius relationship is to calculate what the surface temperature should be, for a given power density.
So, we can model the Sun as a sphere with radius $R$, and a power density of $\rho$. The total volume of the Sun is then
$$V =\frac{4\pi R^3}{3}$$
and the total power output is
$$P =\rho V = \rho\frac{4\pi R^3}{3}$$
The surface area of the Sun is then
$$A = 4 \pi R^2$$
So the power flux through the surface of the Sun is
$$f = \frac{P}{A} = \rho \frac{R}{3}$$
(Notice that this is going like $R$: the bigger the star, the higher the flux for a given power density.)
And we can use the Stefan-Boltzmann law which relates surface temperature to flux, assuming the Sun is a black body
$$f = \sigma T^4$$
And putting this together we get
$$T = \left(\rho\frac{R}{3\sigma}\right)^{1/4}$$
Where $T$ is the surface temperature of the Sun. This formula tells you that large objects which are generating power get much hotter than small ones with the same power density: the surface temperature goes as the fourth root of the radius.
Plugging in the numbers this gives a surface temperature which is much too high, from which I conclude that the power density of the Sun is in fact much lower than the Wikipedia figure: that figure is probably for the part of the Sun where fusion is occurring only, not the whole volume.
If the heap was self-gravitating then the larger the heap, the warmer its center. The idea behind is that at the core the material will feel the pressure exerted by all the layers above, and you probably know that if you put pressure on something, it will heat up.
What is interesting here is that all the outer layers of your self-gravitating "heap" will tend to collapse towards the center (that's what gravity does best), and as a result the pressure will continue increasing and so will the temperature at the core. If the mass of it is large enough, the temperature reached through this mechanism is so high that molecules split, atoms ionize, and nuclei merge, thus generating thermonuclear energy.
This energy, generated at the center, will travel outwards and generate a pressure on the collapsing material. The result is that the system reaches equilibrium, where the hydrodynamical pressure is balanced by the radiation pressure coming from fusion at the center. It is possible to do the math and calculate what is the temperature required to merge Hydrogen into Helium: the result is 15.7 million K.