Why "go off", as in "alarm went off"?
To go off in this sense is related to the expression to set off, meaning to start or to be started. It implies that the subject was in a state of rest, then moved off from that state into action. The phrasal verb to go on already has the meaning of to continue.
An alarm goes off when the alarm is "released" or "raised". An alarm isn't just a thing that is on/off, it's a state of alert.
Similarly when a bomb goes off, it has moved from a gentle, resting state to an excited, explosive state.
Goes off is often used for something that suddenly and explosively changes from a resting state to one of vigorous action.
"The runners have lined up, the starter raises his pistol... and they're off!"
"The gun goes off and everything changes... the world changes... and nothing else really matters." - PattiSue Plumer, runner
While I'm no expert on idiom origin, I'd venture to guess that the phrase is "alarm goes off" because the first alarms were likely those that needed to be wound up. As one winds them up, the mechanical processes inside coil up, around and on top of each other, creating a tension. So when it unwinds...the coils literally come off of one another, causing to tension to be be released as well until finally the coils are all off, and the tension is gone, which allows the other parts of the alarm to vibrate and make noise.