The sun's spectrum is very complex, and indeed there are a lot of "lines" both light and dark (emission and absorption) amidst a sea of what looks to be continuous frequencies.
Note that the atoms you study in a textbook are idealizations. In a hot object such as the sun, some photons come to us by way of atomic emissions, but the speeds of the atoms that emitted them is distributed continuously (something like the Maxwell Boltzmann distribution), so there is a doppler shift to each emitted photon. This "broadens" the spectral line, i.e., turns a discrete frequency into a continuum. This is called Doppler broadening or thermal broadening. However, this is not sufficient to produce a near-completely thermal black body spectrum (thanks to gigacyan for pointing out that this wasn't clear).
Other photons were emitted by nuclear processes and have been bouncing around inside the sun for many years (an astrophysicist could probably tell you how many), and each of these collisions has shifted it's energy in a somewhat random fashion. Furthermore, this energy from fusion, along with gravitational effects, leave most of the sun in the plasma state, where ions and electrons are separate from one another. Because this plasma is extremely hot collisions and recombinations produce even more radiation which is the primary source of the light that reaches us. What we see is called the photosphere, which is the region of this plasma from which light can escape.
The overall effect is called thermalization, where the energy gets moved around in bits and pieces until everything is in thermal equilibrium. In the case of the sun it is only approximate, as different parts have different temperatures, so it is merely a tendency.