How it works
に (to) marks 病院 (hospital) as the destination of the movement. The verb 行く (go) shifts to plain past 行った (went) — note the small tsu: 行く (go) is irregular and becomes 行った (went), not the expected pattern. It's casual, with no です (is) or polite ending.