According to the data you provided, you might be experiencing an infection of the lower gastrointestinal tract. Whether this infection is caused by the anal intercourse can not be told for sure.
You might want to have a stool culture done that will determine exactly the bacteria that caused the infection and the most useful antibiotic.
If the results are negative, then you might be experiencing irritable bowel syndrome with only minor symptoms. Taking carbo medicinalis (medical charcoal) might decrease the quantity of the gasses. Also, avoid taking food that produces too many gasses when digested.