The heatsink when used in the context of electronic devices is a metal structure, usually composed of aluminum fins and copper heat pipes, that wicks heat away from parts such as the CPU, GPU, and other hardware components that generate a lot of heat.
Heatsinks help cool electronic components in two ways: active and passive. Active cooling attaches a fan to the heatsink to dissipate heat more efficiently at the cost of noise, while passive cooling simply uses the heatsink by itself to dissipate heat at a lower efficiency.
Enthusiasts with high end, overclocked components will sometimes opt to use water cooling. Whereas air cooling uses a fan attached directly to the heatsink itself, water cooling uses a circulating hydraulic system to carry heat from the component to a device similar to a heatsink called a radiator which is then usually actively cooled with a fan.