There are a few possible reasons. The pimples could be ingrown hairs. If there are white tops and redness, possibly itching or burning upon touching, they could be infected and it may take a few days for them to disappear. They are usually very small.
Another possibility are larger bumps known as sebaceous cysts. They also have white stuff inside but it may not be able to get rid of them. They usually appear on penis or testicles and arise above the hair follicles and white hairs may be coming out of them. They are considered a normal skin variant.
Another possibility is just pimples but I doubt that because you would get just one or two not more.
They are most likely folliculitis and will go away or you could try using antibacterial creams to get rid of them.
Information on this site is provided for informational purposes only.
It is not meant to substitute for medical advice provided by your physician or other medical professional.
If you have or suspect that you have a medical problem, promptly contact your physician or health care provider.