In United States law, Prosecutorial immunity (or immunity from prosecution) occurs when a prosecutor grants immunity, usually to a witness in exchange for testimony or production of other evidence. It is immunity because the prosecutor essentially agrees to never prosecute the crime that the witness might have committed in exchange for said evidence.
This form of immunity generally comes in two forms. Blanket immunity (sometimes known as "transactional immunity") completely protects the witness from future prosecution for crimes related to his or her testimony. Use immunity only prevents the prosecution from using the witness' own testimony against them. However, should the prosecutor acquire evidence substantiating the supposed crime -- independent of the witness's testimony -- the witness may then be prosecuted for same.
While prosecutors at the state level may offer a witness either use or blanket immunity, at the Federal level use immunity is the norm.
An alternative, and perhaps more correct definition of prosecutorial immunity is the legal privilege of prosecutors that makes them non-liable for civil or criminal charges for their official actions as officers of the government.