"I haven't been swimming" is a common and natural thing to say. It refers to a period of time in the past. "I have you been swimming this morning?" "No, I haven't been swimming this morning."
"I didn't swim" is unusual. It would refer to a particular single event in the past. "How did you cross the river? Did you swim?" "Oh, no, I didn't swim. I walked across the bridge."
It's well-known that these two English tenses are difficult for Portuguese speakers because there isn't a close equivalent in Portuguese. Sometimes the "have been X" form translates into "tenho X" in Portuguese.