Questions & Answers about Vi rakk toget, noe som var veldig heldig.
If you used only som, it would refer back to the noun right in front of it (toget) — which would mean "the train that was very lucky"!
When "which" refers back to a whole event or statement (here, the fact that vi rakk toget), Norwegian uses noe som (literally "something which"), with a comma in front of it.
Rakk is the past tense of the irregular verb å rekke (rekker – rakk – har rukket).
Its basic meaning is "to reach", and with transport, events, or deadlines it means "to make it in time for" or "to catch" — for example å rekke toget (to catch the train) or å rekke bussen (to catch the bus).