Derailment
Digression
noun, verbal noun
When something escapes from the line it should be on, that's a derailment.
脱線 can refer to train derailments (no surprise there), but often gets used figuratively to mean a digression, like in speech or writing. Do you ever derail conversations with your digressions?
This is a jukugo word, which usually means on'yomi readings from the kanji. If you know the readings of your kanji you'll know how to read this as well.
話が脱線しました。
The conversation got sidetracked.
電車が脱線しましたが、ケガ人はありませんでした。
The train was derailed, but nobody was injured.
すいません、また脱線してしまいました。
Sorry, I got sidetracked again.