It's a fungal infection. If the rotten part smells, it's likely erwinia, but it really doesn't matter - the cure is the same. Cut away affected parts, soak the rest of the plant in hydrogen peroxide and dust the cut with cinnamon. Or use some chemical that you need a license for.