History
HAL stands for Heuristically programmed ALgorithmic Computer. HAL's first instructor and creator was a Dr. Chandrasegarampillai, an Indian scientist(in the film 2010 his Indian heritage is dropped and his name is shortened to Dr. R Chandra and in 2001 HAL states his first instructors name was Dr. Langely ). HAL became operational on January 12, 1997(this was changed to 1992 in the film version) at the HAL plant in Urbana, Illinois.
Role in 2001

The Discovery One, home to HAL
In 2001: A Space Odyssey HAL is installed in the Discovery One to operate as the ships pilot and to handle the mass calculations required to travel through space. Both Dave Bowman and Franke Poole, the two waking crew members of the Discovery One, respect HAL and consider him a member of the crew. HAL first shows first shows concerns about the mission when he tells Dave of rumors of something being found on the moon and asks why the scientists in hyper sleep were trained separately from Dave and Frank.
HAL then informs Dave and Franke that a component on their radar dish is about to fail. Immediately Dave decides to bring the part in to fix it. He exits the ship in one of the pods and replaces the part with a temparory part so that way they can bring it back and see what’s wrong.
Testing the equipment Dave and Frank can find nothing wrong. HAL suggests putting it back and letting it fail so that way they can see what happened. Mission control tells them that their twin HAL 9000 on earth did not anticipate this malfunction and they suggest putting the part back in as HAL suggested.
Starting to fear that HAL is lying to them Dave and Franke conspire to shut him off if he does anything else strange. When Dave goes out to put back the original part HAL takes control of the pod and cut Franke's air line causing him to be jettisoned into space. Realizing what has happened Dave immediately gets in a pod without his helmet to retrieve Franke's body, but Franke is already dead.

Dave inside HAL's memory banks.
When Dave returns to the ship HAL refuses to let him in and reveals to Dave that he read Dave's lips and knows that he plan to deactivate him. While Dave is trying to find a way back on to the ship HAL turns off the life support systems of the sleeping scientists, murdering them. Dave lets Franke's body float off into space and manages to reboard the ship through an emergency exit.
Back aboard the ship Dave crawls into HAL's computer systems and begins to shut down his higher brain functions. As Dave removes HAL's memory and other consciousness HAL's consciousness deteriorates and he reverts back to when he was first activated and sings the song Daisy Bell which was one of the first things he was taught. When Dave abandons the Discovery One and becomes the Star Child, HAL is left alone and effectively dead orbiting Jupiter in the Discovery.
Role in 2010
Nine years after the failed Discovery mission, a Soviet spaceship, the Alexei Leonov, is sent back to Jupiter in an attempt to salvage the Discovery One and uncover the mysteries behind the failure of the first mission to Jupiter. The mission is a joint effort between the Soviet Union and the United States. Among the crew was HAL's creator and instructor Dr. Chandra. Once the Discovery One has been reactivated Dr. Chandra boards the vessel in an attempt to discover the reason for HAL's malfunction and restore him. 
The Leonov(right) approaches the derelict Discovery One(left).
Chandra soon discovers the reason for HAL's malfunction; the United States National Security Council had ordered the computer to keep the true objective of the mission from the Discovery One's two waking crew members, David Bowman and Frank Poole. The mission's actual directive was to investigate the signal launched from the monolith on the moon. Bowman and Poole were told this so they could maintain plausible deniability. This order conflicted with HAL's basic function of open, accurate processing of information, and led to his mental breakdown. Dr. Chandra successfully restores HAL to his former intelligence.
When the crew of the Leonov are warned by the entity that was David Bowman that they must escape Jupiter's orbit for "something wonderful is going to happen", they devise a plan to use the Discovery One as a booster rocket so that they can escape Jupiter's orbit. Despite concerns the crew decides to not tell HAL that this plan will leave the Discovery in the orbit of Jupiter without the possibility of a return to Earth and may lead to its destruction. During the countdown to Discovery's launch Chandra tells the computer the truth. HAL agrees that it must sacrifice itself for the human beings on board Leonov. 
Dr. Chandra tells HAL of his fate.
Leonov escapes Jupiter's orbit just as the Monoliths engulf Jupiter and increase its density to the point that nuclear fusion occurs, this transforms the planet into a small star. Bowman commands Hal to repeatedly broadcast a message to Earth:
"ALL THESE WORLDS
ARE YOURS EXCEPT
EUROPA
ATTEMPT NO
LANDING THERE
USE THEM TOGETHER
USE THEM IN PEACE"
(The last two lines were added to the film adaption.) The creation of the star destroys the Discovery, but Bowman is able to rescue HAL's consciousness transforming him into a being like himself. HAL joins Bowman as a companion.
2061 and Beyond

2061: Odyssey Three
While HAL's film career ended in 1984 with 2010: The Year We Make Contact, he lived on in the sequels written by Arthur C. Clarke. Both 2061: Odyssey Three and 3001: The Final Odyssey feature HAL as a minor character.