That's actually a rather interesting question.
As with many things in law, it's the result of historical precedent (aka legacy code).
Historically, computer programs were not effectively protected by copyrights because computer programs were not viewed as a fixed, tangible object: object code was viewed as a utilitarian good produced from source code rather than as a creative work. Due to lack of precedent, this outcome was reached while deciding how to handle copyright of computer programs. The Copyright Office attempted to classify computer programs by drawing an analogy: the blueprints of a bridge and the resulting bridge compared to the source code of a program and the resulting executable object code. This analogy caused the Copyright Office to issue copyright certificates under its "Rule of Doubt".
So basically, software is copyrightable because blueprints are copyrightable, and later legislation was passed to codify this (and legislation doesn't need to be well reasoned or justified, merely politically tenable).
This then leads to the question of why blueprints are copyrightable.
"Consistent with other provisions of the Copyright Act and copyright regulations, . . . protection [of architectural works] does not extend to standard features, such as common windows, doors, and other stable building components." As architect Michael Graves explained, copyright protection covers only the "poetic language" of an architectural work, which includes those parts of the design that are "responsive to issues external to the building, and incorporates the three-dimensional expression of the myths and rituals of society". It does not cover "internal language", which includes those parts of the design that are "intrinsic to the building in its most basic form – determined by its pragmatic, constructional, and technical requirements." Thus, for example, individual elements that are driven by function are not copyrightable, including the presence of doors and windows or those elements required by building codes. Accordingly, architectural designs must be analyzed to determine the scope of their functionality.
So basically, architecture is a combination of art and functional aspects, and only the artistic elements were ever intended to be covered. The problem is that because the judiciary (in most cases) don't understand programming, they are unable to distinguish between them adequately.
IMO, computer programs in general should never have been considered to have an artistic element (and I say that as someone who appreciates beautiful code). A building may be said to have artistic elements because it serves two purposes: a functional one (to provide shelter), and an artistic one (to look good). With the exception of examples in textbooks (which are copyrightable independently of this), code is almost never written to look good, merely to serve a functional purpose. While it may be beautiful, that it not it's primary purpose. They should have been regarded as purely mechanical, and covered by patent law instead.* At this point in time though, it is likely impossible to fix that flaw, given how disruptive it would be.
* I think that software patents should exist, but not in their current form. While computer programs are mathemathical in nature, so are many other patentable creations. For example, the negative feedback amplifier was well-deserving of a patent (given how revolutionary it was at the time), but each of the components in that circuit could be well-defined mathematically. If the requirements for a patent were enforced properly (i.e. novelty/obviousness and the limitation to an implementation, as opposed to a goal/idea), then they would actually be useful.