It is still an open question, even though it is clear that it is linked to the magnetic field of the Sun. The following hypothesis are the following:
Heating waves mechanism: propagation of magnetohydrodynamic waves can heat significantly the corona. These waves can be produced in the solar photosphere and propagate carrying energy through the solar atmosphere; they turn in the end into shock waves that dissipate energy as heat in the corona.
Magnetic reconnection mechanism: magnetic field lines are tied to the surface of the Sun and even when the plasma moves, they stay tied to their original position (their "foot points"); therefore, plasma movements can drag the magnetic field lines and entangled them in geometries such as loops, that can eventually "reconnect". "Reconnection" corresponds to a modification of the field line topology (see the image that pictures it better than my words). During this process, heat and energy are released quite efficiently.
Nanoflares mechanism: the dissipation of a lot of small scale structures (slow convective motions of magnetic foot points could create current sheets, coutinually dissipated and reformed, providing heating through Ohmic dissipation). You can see it as a kind of a lot of magnetic loops reconnecting together, instead of one big loop reconnecting alone.
Black lines represent the magnetic field lines. They are tied to the surface of the Sun (the foot points). One of the magnetic field lines is looping, and it is "crossing itself". When it reconnects, it forms, on the top, a magnetic loop and, on the bottom, an magnetic arch. As pointed out by this diagram, magnetic reconnection mechanism is also associated to Coronal Mass Ejection (CME), since the energy released by magnetic reconnection is powerful enough to eject a significant amount of matter.
Source: A Contemporary View of Coronal Heating