Penicillin was discovered by Alexander Fleming in 1929. What happened was that he noticed that, on a agar plate streaked with a bacteria, Staphylococcus Aureus, there was a contaminant mold that got onto the plate and that there was no bacterial growth directly around this mould.

The fungus was found to be Penicillum notatum and thus the substance that was found to have these anti-bacterial properties was called penicillin.

It was not until the 1940s that penicllin was purified by two other scientists, Ernst Boris Chain and Howard Walter Florey. It has since become the most widely used antibiotic to date and is still used for many Gram-positive bacterial infections.

Penicllin works by inhibiting the formation of peptidoglycan cross links in the bacterial cell wall by directly competing for the reaction site (the beta-lactam ring of penicillin is a chemical analogue for the enzyme that links the peptidoglycan molecules in bacteria) and thus preventing the bacteria from multiplying (or rather causing cell lysis or death when the bacteria tries to divide)

Antibiotic resistance to penicillin is now common amongst many hospital acquired bacteria. The resistance to penicillin has been partly (maybe mostly) due to the rise of beta-lactamase producing bacteria which secrete an enzyme that breaks down the beta-lactam ring of penicillin, rendering it harmless to the bacteria.