I imagine it comes from the construction industry in the same way that a "firedoor" tries to prevent the spread of fire from one room to another a firewall tries to do the same with data but only allows that data that you intend to enter and leave.
Bluetooth (meaning dark complexion) is named after a Danish King from around 910AD who "united Denmarka and Norway" - whether he did this using wireless technology is debatable -
TWAIN was an acronym developed playfully from "technology without an important name." However, the TWAIN Working Group says that after the name chosen originally turned out to be already trademarked, an 11th hour meeting of the group came up with TWAIN, deriving it from the saying "Ne'er the twain shall meet," because the program sits between the driver and the application. The name is not intended to be an acronym.
A fire wall is a type of wall that is designed to prevent a fire on one side of the wall from passing to the other side. This may be between two neighbouring houses (ever wondered why the dividing wall in terraced houses continues through the roof, not just up to it?), or to separate the hazardous process area in a factory from the non-hazardous area, and so on.
By analogy, a computer firewall provides a total barrier between two sides of a network, typically the inner, private, LAN, and the wider WAN or Internet. It therefore acts similar to a fire wall - keeping the occupants on one side safe from the harm that can exist on the other side.