To understand the heroic qualities of the legendary hacker, it is important to understand at least a little about the culture from which they come. The culture of the computer hacker is very young. Although I'm sure that there are analogous communities of people skilled in similarly complicated disciplines, the computer hacker culture is connected intimately with the electronic stored-program computer. Computers of this type have existed only since the 1950's. The stored-program qualifier is important. Although it seems obvious today, the idea that a program that controls the actions of the computer can be stored in the same type of memory that is holding the data that the program was working on was in fact a major leap of understanding for the early computer designers.
Computers are built from electronic components that, while complex in their manufacture and their organization into systems, are essentially nothing more than very small, very fast switches. Switching theory, which is the science of studying systems built from switches, is far older than computer science. Telephone systems are an example of a switching network where calls must be routed through a switching network to find the desired receiver. Railroads are another example of a switching network. Consider the problem of making sure that two trains will not try to use the same piece of track at the same time but in opposite directions. The railroad system is a system of switches that control where the trains go and which section of track they will use.
Both of these examples are related to the early examples of hacker culture, but the railroad example is of particular importance. The first computer hackers are generally agreed to have been students at MIT in the 1950's who were part of the Tech Model Railroad Club (TMRC) . This club had (and probably still has) a huge model train layout that was the focus of the club activities. The subcommittee of the club responsible for the complicated wiring of the switches that controlled where the trains went were hackers waiting to happen. The switching network of the TMRC railroad was essentially a special purpose computer, but one where the programming was done either by changing wires, or by real-time control of the switch settings by the operator.
When these railroad-switch-hackers discovered the computers that were being installed at MIT in the 1950's, some of them immediately realized that these large, cumbersome calculating machines were exactly the type of things they had been struggling to create with the model railroad layout. Some would become enthralled with trying to figure out what they could make the computers do. This exploration, for the type of person who would come to be called a hacker, would be simply out of an intense desire to explore the limits of the technology. If the explorations resulted in programs that were useful to others, so much the better, but the motivation of the exploration was simply to gain information about and control over the computer. From the beginning, the hackers found themselves outside the traditional scientific community that was also trying to understand what could and could not be done with these new-fangled computers. It was the hackers, however, that understood how far the technology could really be pushed.
It was the hackers, working in the early hours of the morning because that was the only time they could get access to the machines, who first demonstrated that a computer could do the then unthinkable task of playing a game of chess. Hackers first demonstrated that the computer display could be used in an interactive way. That it, rather than simply be used for static status information on the machine, you could cause the machine to draw shapes that looked like spaceships and play games by causing the ships to move around on the screen and interact with other shapes. Hackers were the first use the computer in an interactive way for entering text. To an engineer of the day, using valuable computer time to simply enter text in an interactive text editor was unthinkable. It was the hackers who understood that interacting with the computer, rather than treating it as a hands-off behind-glass computation resource, was the way of the future.
Because they were operating outside of the official engineering and scientific culture of the day, the hacker developed a bit of an outlaw persona from the first. It's important, though, to make a distinction between a notion of outsider and that of a criminal. Prototype hackers were not criminal; they were simply operating outside the bounds of the established culture of the day. Working mainly at night, without formal scientific backgrounds or training, hackers were simply exuberant, fearless, non-conventional explorers of this new world of computing.