Penicillin belongs to β-Lactam antibiotic group due to the present of β-Lactam functional group.
The β-Lactam functional group is shown in red

Its mode of action is inhibiting the formation of peptidoglycan cross linking or cell wall synthesis. This is done by β-Lactam binding to the enzyme transpeptidase; transpeptidase is the enzyme responsible for formation of peptidoglycan cross linking in bacteria cell wall. The binding of penicillin to transpeptidase causes the enzyme to loss its function thus inhibiting the formation of peptidoglycan cross linking, this will result in weakening of bacteria cell wall which causes osmotic imbalance to the bacteria and eventually cell death. Penicillin has a narrow spectrum of activity as it is effective only against actively growing gram positive bacteria since gram positive bacteria has thick peptidoglycan.

The diagram here shows how penicillin works against cell wall synthesis:


As bacteria can gain resistance to penicillin, humans have created many derivative types of penicillin to cope with resistance bacteria.

All penicillin or penicillin derivative has a constant core region which is the 6-APA
The only region that is different from different types of penicillin derivative is its R group


Eg of derivate penicillin,

Penicillin G (most common kind of Penicillin)
Penicillin V

Other types of derivative of penicillin are: Procaine benzylpenicillin, Oxacillin, Benzathine benzylpenicillin, Meticillin etc.