Penicillin was the first antibiotic to be commonly used to treat many types of bacterial infections. It's discovery ushered in a new age of medicine - making many previously untreatable infections quite manageable. Society was dramatically changed for the better in ways that are hard to describe in a short paragraph. Not even the Internet or the stupid iPhone had as much impact on people's lives as the discovery of penicillin - and that's saying something.
So how does this vitally important bacteria work? The mechanism of action for penicillin is actually quite interesting. The outer cell wall of bacteria has many different chemical structures. Penicillin is able to bind to some of those specific structures and inhibit the growth of the bacterial cell wall. If the bacterial cell cannot grow more of it's protective cell wall, it will eventually die.
Penicillin is an antibiotic known as a "beta-lactam". This refers to a specific structure in the penicillin molecule called, most appropriately, a "beta-lactam ring". Penicillins aren't the only antibiotics to have this chemical structure, cephalosporin antibiotics also have this structure.
Because they have similar structures, penicillins and cephalosporins have similar side effects, although they do not always work on the same species of bacteria. There are many different sub-types of these antibiotics, each of which has a subtly different structure which is able to target different species of bacteria.
Interestingly, it is the beta-lactam structure of penicillin that enables bacteria to become resistant. Some bacteria produce a chemical known as beta-lactamase. This is an enzyme that is capable of breaking down a beta-lactam ring, making it harmless to the bacteria. It's a sort of chemical warfare at the microbiological level. Not all bacteria make this beta-lactamase, but those that do cannot be killed by penicillin (or cephalosporins). Other antibiotics with different structures and different mechanisms of action must be used against these beta-lactamase producing bacteria.
Penicillin, like all antibiotics, is not effective against viral and fungal infections. This is directly due to the way it works. Viruses and fungi do not have the proper cell wall structure for penicillin to attack. Without those structures in the cell wall, penicillin cannot function. Penicillin is an amazing medication. It's works in a very simple manner, it's inexpensive to produce, and it has a tremendously positive effect on many types of bacterial infections. If you have questions about this or any other antibiotic, be sure to talk to your doctor or nurse.