

Protons do repel electromagnetically. In the nucleus however, this is counter-balanced by the strong nuclear force. The strong nuclear force is a short-range attractive force and does not manifest at distances larger than a couple of femtometer. Interestingly, it also becomes repulsive at much shorter distances and this is what determines the size of the nuclei (nucleons dont come much closer together than is allowed by this force).
