Why does Penicillin only affect bacterial cell walls
Bacteria have a mesh-like structure surrounding their plasma membrane called a cell wall.  The cell wall is made up of peptidoglycan polymers that form a rigid crystalline structure that helps protect the osmotic pressure of the bacterial cytoplasm.  

Penicillin and other &beta;-lactams work by inhibiting the final step of peptidoglycan synthesis, which prevents transpeptidation (crosslinking) of the peptidoglycan molecules. This leads to the death of the bacterium by osmotic pressure due to the loss of the cell wall.

This drug doesn't affect human cells because they lack a cell wall surrounding their plasma membrane.