I was wondering why does something goes off, when it in fact does the opposite
- bomb goes off - it blows up
- alarm goes off - it turns on
Why not goes on?
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.
As an alternative to the other two answers, I think of "going off" as a trap or reaction getting triggered. "The bomb goes off" means that the reaction was triggered. Rest and motion are not really relevant. Same with a "trap going off" — the trap was waiting for a particular event and then *bam* it went off. "Went off" is a phrase for someone exploding in emotion against another and also brings to mind a triggering event.
An alarm fits in this category of words: "The alarm went off." The trigger for an alarm is a particular time and, when the time arrives, *bam* it goes off.
There are two different meanings in play here:
The distinction between working/active ("on") and not-working/inactive ("off").
The description of a dangerous, sudden, loud, or explosive act occurring: "setting off" an explosion, "sounding off" at roll call (i.e. shouting out "present", "here", or something like that in response to your name being called).
So you could say "the alarm went on" and would be understood, but it's not idiomatic. The picture is that the alarm is loud (a siren, bell, etc) and indicates danger of some sort. In a computer system, an "alarm" might simply be a light or a sentence printed, but the mental picture still applies.
A light "goes on", so you might even see an indicator light "go on" indicating that an alarm has "gone off".
To be on something is well-defined as a state of being poised in one position, and as the antonym of that, "off" directly suggests being set in motion or released (I'm off, they're off, the plane takes off, we set off fireworks, etc.). I think a bomb or alarm clock "going off" makes pretty clear sense in that light.
The answer that it ‘goes off’ because it ‘go’ means to ‘perform its function’ may appear logical, but it is actually somewhat puzzling in comparison to ‘goes on’. Which can mean either of ‘starts’ or ‘continues’ - but those meanings could instead also be claimed to be a result of the word ‘on’ as much as from the word ‘goes’.
What I think these explanations overlook is the observation that the inherent meaning of the word ‘go’ is to move away, and so the origin of the usage ‘go on’ or ‘go off’ would actually be because the phrase explains that something went through some state of motion away, or leaving. To ‘go off’ can also mean leaving completely.
Now with regards to alarms, what kind of ancient alarm system can we think of that goes into motion and leaves? Well, probably dogs, who with their keen senses are the quickest to react to anything unusual and are raise a large noise but also to ‘go off’ to investigate or chase the quarry in a hunt.
So I think it is a reasonable hypothesis that the true origin of this phrase is to explain that the dogs ‘went off’ raising a ruckus as they did so, and the later usage for explaining the action of alarm clocks suddenly going off is a transferred usage (for the similarly sudden and startling noise).
In the case of bombs, or gunpowder, they appear to leave (or go off) by virtue of the fact that once exploded, they appear as gone; vanished.
It dates from medieval England when households revolved around a fire upon which a pot would be continuously simmering. This was linked to some sort of bell which would chime continuously. If the fire went off, the energy (heat) from the fire would stop the chiming thus causing the alarm. Hence we use the phrase when the alarm goes off!