In the Sun there has been much progress towards answering fundamental problems with profound implications for the behaviour of cosmic magnetic fields in other stars. A review is given here of such problems, including identifying some of the outstanding questions that remain. In the solar interior, the main dynamo operates at the base of the convection zone, but its details have not been identified. In the solar surface, recent observations have revealed many new and surprising properties of magnetic fields, but understanding the key processes of flux emergence, fragmentation, merging and cancellation is rudimentary. Sunspots have until very recently been an enigma. In the atmosphere, there are many new ideas for coronal heating and solar wind acceleration, but the mechanisms have not yet been pinned down. Also, the detailed mechanisms for solar flares and coronal mass ejections remain controversial. In future, new generations of space and ground-based measurements and computational modelling should enable a definitive physical understanding of these puzzles.