It is important that you don't just accept a bad reference straight away. Individual formulations or an inappropriate assessment can ultimately significantly reduce your success in applying for a new job.
If you are not satisfied with your reference, your first step should be to talk to the HR department or your boss. An open discussion can often have a clarifying effect, is unbureaucratic and can already lead to the desired changes in the reference. If the direct approach is unsuccessful, it is important that you submit a written objection directly. In your letter of objection, you should specifically point out the wording with which you are dissatisfied and suggest alternative wording. Only as a final step should you take legal action. However, it is important to do this within three weeks of receiving the reference, as otherwise the deadline for a so-called action to rectify the reference will expire.