に来たんだ

came to do something, came to (a place)

→ に
phrase Common #3,524
came to do something Attach に to a verb stem or a noun to state the purpose of coming; んだ gives the statement a casual, explanatory tone.
JA: 助けに来たんだ。
EN: I came to help.

マリオン何しに来たんだ?

Marion, what brings you here?

— サイコ (1960)

取引に来たんだ

I came to make a deal.

— ウエスタン (1968)

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

I’m here to cover the firefighters in action.

— REC / レック (2007)

カヌーをしに来たんだよ。

I came here to go canoeing.

戦いに来たんだ

I came to fight.

— 炎628 (1985)

報告に来たんだ

I came to give you an update.

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

助けに来たんだ

I came to help.

— Брат 2 (2000)

phrase Rare #45,620
came to (a place) A conversational way to state or explain that someone came to a place; the place is named before に.
JA: 仕事を探そうと思ってオーストラリアに来たんだ。
EN: I came to Australia because I wanted to look for work.

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

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

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

Why did you come over to this side?

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

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

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