に来たんだ

came to

→ に
phrase Common #3,238
came to に marks the destination or purpose, while んだ adds an explanatory or emphatic tone. The phrase is often used in casual speech; the more polite form is に来たんです.
JA: 謝りに来たんだ。
EN: I came to apologize.

でもその子は本当に一人で東京に来たんだ

But that kid really did come to Tokyo all by herself.

カヌーに来たんだ

I came here to go canoeing.

助けに来たんだ

I came to help.

— Брат 2 (2000)

戦いに来たんだ

I came to fight.

— 炎628 (1985)

仕事を探そうと思ってオーストラリアに来たんだ

I came to Australia because I thought I’d look for a job.

どうしてこっち側に来たんだ

Why did you come over to this side?

— バジュランギおじさんと、小さな迷子 (2015)

取引に来たんだ

I came to make a deal.

— ウエスタン (1968)

報告に来たんだ

I came to give you an update.

— M - Eine Stadt sucht einen Mörder (1931)

やればあんたを殺しに来たんだ

I came here to kill you.

— ブレット・トレイン (2022)

消防士活躍ぶり取材に来たんだ

I’m here to cover the firefighters in action.

— REC / レック (2007)