The NJL7502L is a phototransistor with a spectral response similar to the human eye. It can be used to measure the ambient light levels for applications such as night lamps or photography.
A phototransistor is actually just a photodiode with a transistor attached. Photodiodes can also be used to measure light directly, but a phototransistor amplifies the signal from the photodiode making it much easier to use. There are only two terminals on this device because the transistor base current is provided by the photodiode. The two legs are for the collector and emitter.