A DI Box (Direct Input Box), also known as a direct box, is used in a live situation or in the studio to take an unbalanced hi impedance signal such as a guitar or keyboard output, via a instrument / guitar lead and convert it into a balanced low impedance signal via a microphone cable. There are two advantages to this.
1. Converting to a balanced signal means that the signal will receive minimal interference over a long cable run, such as stagebox to front of house mixer.
2. A stagebox / multicore is designed to carry low impedance signals. Line signals will lose a degree of clarity if plugged directly into a stagebox. In addition, converting to low impedance signal means that the signal is suitable to plug into a mixing console's microphone input.
This generally gives the engineer a lot more control over the signal level and EQ, as these components are usually more customizable on a microphone channel strip than a stereo line channel strip. It also allows the use of insert units such as compressors and gates via the insert jack, which usually isn't present on a line channel.
Active DI vs Passive DI
There are two types of DI's out there, and knowing which one to use is important in getting the most out of your instrument.
Passive DI
A Passive DI uses completely un-powered circuitry. It does not require a battery or phantom power to operate. Passive DIs feature transformer isolators which help prevent ground loops in a setup, and therefore are good to use with powered instruments such as keyboards. The attenuation switch will also help to scale the keyboard signal down to feed a mic preamp. Generally the input impedance is limited by the transformer circuitry, and can be a little low for something like a passive bass.
Active DI
An active DI runs off 48v phantom power or battery power. These DIs have a much higher impedance range than a passive DI, and are best suited for instruments that do not have active pickups, such as a bass guitar. A good active DI will present a much higher impedance, and therefor will give a clearer, stronger signal for a passive instrument. The lack of transformer isolation means that using it on a powered instrument may result in a ground loop hum.
There are also active DIs that have transformers - these can be the best of both worlds because they can offer the higher input impedance of the active device and also give you the galvanic isolation of an output transformer without the need for a high transformer turns ratio.