Taking color pictures with the Hubble Space Telescope is much more complex than taking color pictures with a traditional camera. For one thing, Hubble doesn't use color film — in fact, it doesn't use film at all. Rather, its cameras record light from the universe with special electronic detectors. These detectors produce images of the cosmos not in color, but in shades of black and white.
Finished color images are actually combinations of two or more black-and-white exposures to which color has been added during image processing.
The colors in Hubble images, which are assigned for various reasons, aren't always what we'd see if we were able to visit the imaged objects in a spacecraft. We often use color as a tool, whether it is to enhance an object's detail or to visualize what ordinarily could never be seen by the human eye.
HubbleSite - Behind the Pictures - Meaning of Color