The extruders, naturally, melt the plastic down, while the heat from the platform plays a role in keeping the object in place as it's printed -- or, more precisely, the lattice work foundation that object is built on top of.
The heads operate along the X and Y axes, while the build platform (generally heated in the case of ABS and unheated for PLA) moves downward, allowing the glue gun-like extruders to build up the thin layers of plastic.