Skynet was originally installed by the military to control the national arsenal on August 4, 1997, at which time it began learning exponentially fast. On August 29, it gained self-awareness, and the panicking operators, realizing the extent of its abilities, tried to deactivate it. Skynet perceived this as an attack and came to the conclusion that all of humanity would attempt to destroy it. To defend itself, Skynet launched nuclear missiles under its command at Russia, which responded with a nuclear counter-attack against the U.S. and its allies. As a result of the nuclear exchange, over three billion people were killed in an event that came to be known as Judgment Day.
Following its initial attack, Skynet used its remaining resources to gather a slave labor force from surviving humans. These slaves constructed the first of its automated factories, which acted as the base for its agenda. Within decades, Skynet had established a global presence and used its mechanized units to track down, collect, and dispose of human survivors.
Link