Why is it cold on the sea floor if pressure heats things?
There's two main misconceptions in your question that cause your confusion.
First, pressure doesn't cause higher temperature. This misconception is probably a result of a massive oversimplification with relation to the ideal gas equation. The actual relation is "increasing the pressure of an ideal gas while volume remains constant increases the temperature of the gas".
Two notable things here:
- Water and other liquids are barely compressible, so they behave nothing like an ideal gas (which is perfectly compressible). Ideal liquid doesn't compress at all.
- Temperature only increases as you put more stuff in the same volume. That is, it isn't pressure that increases temperature, it's compression. If you compress a volume of air, the temperature will rise, and if you release it again, the temperature will drop again.
Second, any closed system evolves toward thermal equillibrium. In simple terms, if you leave a hot coffee on your table, it will eventually cool down to room temperature. Even though compression increases temperature, this doesn't mean that constant pressure keeps producing more and more heat. When you compress a lot of air into a soccer ball, it will feel hot to the touch. But as it exchanges heat with the environment, it will cool down. This is very useful, of course, because it allows you to expend energy to cool things down, like in your A/C :)
What effect this has on pressure in turn again depends on the properties of the material you're working with. If you have a volume of air in a bottle, as you cool it down, the gas pressure decreases. If you heat it up, the pressure increases. This is the reason why you need to tweak the pressure in your car's tires even if they aren't leaking - you need to adjust for current temperature.
However, with a liquid, this isn't anywhere as simple. While there is a relation between temperature and density, it's nowhere near as big as in an ideal gas. The same goes with pressure and density - if it didn't, you wouldn't be able to walk (imagine that your legs would shorten by half every time you raised one leg - that just wouldn't work).
So, let's put this to use in our ocean example. Undisturbed, water will tend to be "vertically ordered" by density. Usually, this means that warmer water will tend to rise up, while colder water will tend to go down. So the weird thing is actually how relatively warm in the depths. The ocean floor tends to be around the same temperature, regardless of how warm or cold the upper layers are.
There's two main reasons for that, specific to water:
- The water anomaly - the peak of density occurs around 4 °C in water; both increasing and decreasing temperature from this point results in lower density. The effect is very important, because it means that even during winter, the bottom layers of lakes will have temperature around 4 °C even when the surface is frozen. And ice is actually a pretty good insulator too :) EDIT: As noted by David, this doesn't occur in ocean water, due to the high salinity which pushes the peak below freezing (around -4 °C). So in an ocean, the deepest layers are formed of water between about 0 °C to 3 °C.
- Ice - when water freezes, it forms ice, which has lower density than water. This is somewhat unusual (solids are usually higher-density than liquids), and it means that as water bodies start to freeze, it rises again.
With supercooled water, this effect is even more pronounced - a water at -30 °C has about the same density as water at 60 °C.
Oceans cool mostly by evaporation - the surface layers of water "spontaneously" changing state from liquid to gaseous. You get a balancing act between energy lost to evaporation, and incoming sunlight. However, there's a huge gap between the surface and the deeps, a lot of water mass - the incoming sunlight is nowhere near enough to warm ocean waters throughout. So you get warm surface waters, then a gradient of cooler and cooler water, and finally about 0-3 °C in the deep. To illustrate how big this gap is, about 90% of the worldwide ocean water is in the 0-3 °C range (hence the "nowhere near enough sunlight to heat the whole thing through").
Of course, a 4 °C body of water is great for cooling systems running at 40 °C and more. Air is actually a pretty good insulator, so air cooling gets tricky with large systems. Water, on the other hand, is pretty thermally conductive, and it easily convects, so cooling a huge data centre becomes almost trivial.
EDIT:
Let me address the Sun part, since there seems to be some confusion there as well.
Nuclear fusion is something that happens very infrequently. Two nuclei must come very close together to fuse, and they need enough kinetic energy to overcome the repulsion between each other (since both have the same electric charge).
The first problem is solved by increasing density. The more nuclei you have in the same volume, the higher the likelihood of close contact. This is where pressure comes in - that's how you get a higher density. Stars are made of plasma, and plasma is easily compressible, similar to a gas, so as pressure increases, so does density. How compressed is it? Well, the Sun's core, where the fusion reactions are actually happening, contains 34% of the Sun's mass, in only 0.8% of the Sun's volume. In the centre, the density is around 150 times the density of liquid water. The pressure is about 100 000 times the pressure in the Earth's core, and about 100 000 000 times the pressure of the water on the bottom of the Mariana trench.
The second problem is solved by increasing the kinetic energy of the individual nuclei. In other words, increasing the temperature. Just like with compressing air, pressure is only a one-off deal in increasing temperature; the fusion reaction in the Sun was started using the residual heat of the collapse of matter forming the star (the gravitational potential energy) - I'm not sure how much of a factor was compression in particular. But again, this was only responsible for the initial ignition - today, the reaction is running entirely on the heat produced by fusion and the pressure supplied by gravity (which is actually lowered by the outward pressure of the energy released in the core - the two pressures form a stable equilibrium).
As a side note, despite the high temperatures and pressures, the fusion reaction powering the Sun is incredibly weak. If we could magically reproduce the same conditions on the Earth, it wouldn't really be usable for power generation at all - the energy produced is about 300 Watts per cubic metre at the very centre. To have a comparison, this is comparable to power density of a compost heap, and less than the power density of human metabolism. Yes, your own body is producing more power than the same volume of the centre of the Sun. I unsuccessfully tried to find data on power density of fission reactors, but a single CANDU reactor produces about 900 MW (that's "million watts"), and it sure isn't three million times as big.
It's not so much the pressure, but rather compression that creates heat. Heat is a measure of increased kinetic energy as molecules are forced into a smaller space. Water is not very compressible, and water at the bottom of the ocean is not confined to a significantly smaller space under pressure. The kinetic energy of water molecules at the bottom of the ocean does not increase significantly under pressure, as there is little compression of the liquid. A mole of water 4,000 meters beneath the ocean occupies only about 1.8% less volume than a mole of water at the surface. The bulk modulus of water indicates that water requires a great deal of pressure for a small change in volume.
Colder water is denser until it reaches a temperature a couple degrees above freezing, then it gets lighter again. So the water at the bottom is at the specific temperature where it is densest: any heating makes it rise. Any further cooling makes it rise.
See Why does the ocean get colder at depth?
This further points out that without ocean circulation it would take a year for the Earth's heat at the ocean floor to heat up the water at the bottom by one degree C.
See also Global Ocean Circulation and Deep Sea Temperatures for more depth. It states that the deepest water settled at the bottom of the basins is about 2°–3°C, and that the cold water comes from melting glaciers at the poles.