Hi thanks for your question.
You have got breast abscess
,your question is how you got it,There are millions of bacteria on surface of skin and breast is full of fatty tissue.Fatty tissue have poor blood supply,bacteria gain entry into fatty tissue through abrasion in skin,through hair root or through blood stream,since as I mentioned fat has poor blood supply it cannot eliminate the bacteria,Bacteria multiply in fatty tissue of breast and result in puss formation.You need cosultation with general surgeon
who may drain you breast abscess if required and may prescribe you antibiotics.
Hope this answers your question.