I admit I was wrong.

Literal

I [subject-が] was-bad thing [object-を] admit.

ことを here nominalizes 僕が悪かった into a noun-like clause that can serve as the object of 認める ('to admit, acknowledge'). こと leans formal and abstract, fitting an admission of wrongdoing as a proposition rather than a witnessed action — の would feel slightly more colloquial. Writing 悪い in kanji rather than hiragana reinforces the considered, slightly weighty tone.