Penicillin works by binding to penicillin binding proteins and disrupting the cross-linking process in bacterial cell walls. This prevents cell wall synthesis and causes bacterial lysis. However, bacteria have developed resistance through mechanisms like beta-lactamases, which are enzymes that break down the beta-lactam ring structure of penicillin. To address this, beta-lactamase inhibitors like clavulanic acid were developed that bind irreversibly to beta-lactamases and protect the antibiotic from destruction.