What determines if a lamp produces emission or blackbody spectra? If we take a lamp containing hydrogen gas and heat it up (gas-discharge lamp), it produces hydrogen's emission spectrum. Why doesn't it produce a blackbody spectrum? After all, the gas has some temperature, and that allows for a blackbody spectrum.
Similarly, why does an incandescent light bulb (which has a tungsten filament within) yield a blackbody spectrum when heated, as opposed to tungsten's emission spectrum?
 A: Imagine an envelope containing mostly vacuum and a little of the gas of your choice and a pair of electrodes. We connect the electrodes to a high voltage supply which contains a current limiter (usually a big resistor called a ballast). We apply the voltage, shine some UV light on the electrodes (this is a handy trigger for gas breakdown) and notice that the gas becomes electrically conductive. With the current limiter choking the current, only a trickle of electricity flows through the gas, and its line spectrum is emitted. A blackbody spectrum in the visible range is not emitted because the dilute gas in the envelope is cool.
Now we allow more current to flow and in response, the gas becomes more thoroughly ionized and its electrical resistance falls. The current limiter chokes the system and the light output from the gas becomes brighter, the gas begins to get warm, and the blackbody spectrum moves up closer to the visible range.
If we open up the current limiter some more, the ionization becomes yet stronger, the resistance falls still further, the current goes up and the brightness of the gas goes up too. Now the gas starts getting hot enough to radiate like a black body in the visible range and so the thermal emission spectrum appears superimposed on the line spectrum.
Now we remove the current limiter altogether so the hot gas can pass as much current as the power supply can furnish and a power arc develops between the electrodes, whose tips become red hot as the gas turns brilliantly incandescent. The line spectrum is completely overwhelmed and all you see is the blackbody spectrum — until the thing gets hot enough to melt the envelope and it explodes.
It might not be possible for you to get hydrogen gas hot enough to experience all this, but for things like sodium vapor you can.
You can see this process occur step by step by carefully observing an old-school mercury vapor bulb as it starts up from the fully cold state and then comes up to full temperature. When running at full output, its emission lines are still very much present in the mix but there is a thermal spectrum happening too. Looking at the light output through a diffraction grating will reveal the lines (which include some intense but invisible UV, hence the danger to your eyes) and the continuous background.
Don't try this with a mercury vapor tube that is not designed to run hot! Mercury is extremely toxic and you do not want a hot mass of it blowing up in your face!
A: Basically, light is emitted when a charged particle moves from a high energy state to a low energy state. In a low density gas, such as your hydrogen lamp, this occurs due to electrons in excited orbits relaxing into lower energy states, so you get molecular hydrogen's emission spectrum. Energy for these emissions is supplied by collisions between electrons and hydrogen molecules.
In a tungsten filament lamp, electrons do not have discrete energy levels but rather exist in a continuous "conduction band", so a continuous spectrum is possible as a continuum of transitions can occur.
For something like the Sun things get more complicated. You get an emission spectrum, but atoms are moving fast enough that there is some doppler shifting of those energy levels so the spectral lines are broadened. The gas is also ionized, so you have additional atomic and molecular species, with different emission spectra superimposed on top of each other, and free electrons which can emit a continuum of wavelengths when their momentum changes through collisions or when they recombine with a nucleus.
I'd recommend reading up on the electronic band structure as understanding this phenomenon is essential to answering your question.
Edit: I realized I didn't cover the issue of the Maxwell Boltzmann distribution. For a material in thermal equilibrium, and neglecting possible quantization of vibrational energy states, kinetic energies of atoms will follow a Maxwell-Boltzmann distribution. So, if energy for your light emission is supplied by thermal vibrations exciting electrons to higher energy states through collisions, and subsequent relaxation of those electrons, then the emission spectrum will be related to the Maxwell-Boltzmann distribution. However, not all light sources rely on conversion of thermal energy to light energy: in fact, this is an extremely inefficient process so it isn't desirable at all from an energy-efficiency standpoint! For light sources that do NOT rely on thermal-to-light energy conversion, the spectrum need not resemble a Maxwell-Boltzmann distribution at all. Case in point: LED lights emit according to the energy gap between the conduction and valence bands. Hydrogen lamps rely on a plasma discharge, where you have hot electrons exciting a cold gas.
So, the spectrum is determined by the energy transitions that occur in the material, and the manner in which these transitions are excited in the first place.
A: To be a blackbody a source must be in thermal equilibrium and be capable of absorbing all radiation that is incident upon it.
The hydrogen discharge lamp can do the former - the hydrogen energy levels are populated according to the Boltzmann factors$^1$ and there may even be a little ionisation. However, it cannot do the latter - it could absorb radiation at the discrete frequencies governed by the hydrogen energy levels, but is otherwise quite transparent (by design).
To get it to emit as a blackbody (why would you want to do that - you use discharge lamps to see the line spectrum?) you need a source of absorption over a continuum of wavelengths and you need to make sure there are enough absorbers (by making the gas dense, or having a large amount of gas) that it is opaque to radiation. That could be done (and is done in the Sun for example) by raising the temperature and having significant amounts of hydrogen photoionisation, which then allows a photorecombination continuum (in practice this actually involves H$-$ ions in the Sun). If you then ramp up the density of the gas, the recombination continuum would get stronger, gradually filling in the gaps between the emission lines until you approached a blackbody spectrum. I doubt there is enough hydrogen gas in a discharge tube to do this, since by design they are meant to display clean line spectra.
A filament lamp is different. The solid filament already has a continuum of conduction band energy states available to populate and depopulate. It is thus opaque to radiation at a wide range of frequencies corresponding to the continuum of transition energies between these states. If in thermal equilibrium, then the radiation it produces will be continuous and approximate to a blackbody spectrum.
$^1$ This is only really true for thermal excitation. In most discharge tubes you are supplying energy by accelerating electrons and ions with electric fields. In such circumstances it is unlikely that the atoms, ions and electrons have energy distributions characterised by Maxwell-Boltzmann distributions and therefore could not emit blackbody radiation (or even thermal radiation) at a well-defined temperature.
A: The hydrogen gas you have isn't absorbing enough heat/radiation to emit in all frequencies. It emits its usual line spectra. You may need to really heat that up to see all the vibration modes to show up and contribute to that radiation.
