The department said the merger would lessen competition and lead to higher consumer prices.
AT&T vowed to fight the move, calling it a radical departure from US anti-trust practice.
US President Donald Trump objected to the deal during his campaign last year, fuelling the controversy.
AT&T chief executive Randall Stephenson said on Tuesday that he thought the acquisition had been on a good path “until recently”.
He referred to concerns about possible political influence as the “elephant in the room”. President Trump is a vocal critic of CNN which is owned by Time Warner.
Mr Stephenson said: “There’s been a lot of reporting and speculation whether this is all about CNN. And frankly I don’t know. Nobody should be surprised the question keeps coming up.”
In its lawsuit, the Department of Justice claimed that the deal would harm American consumers.
Assistant attorney general Makan Delrahim of the Department of Justice’s antitrust division, said: “It would mean higher monthly television bills and fewer of the new, emerging innovative options that consumers are beginning to enjoy.”
The Department of Justice started reviewing the deal after it was announced last year, then valued at more than $85bn.
The decision to take legal action sets up a high-profile fight over US anti-trust law, which has rarely been tested in cases involving companies that do not directly compete.
‘Concentration of power’
George Hay, a professor of law and economics at Cornell, said there is “no question” the merger merited serious review of the potential competitive impact.
However, he said the lawsuit is noteworthy given the president’s comments during the presidential campaign.
“There would be nothing unusual if you didn’t have all of this political background,” he said.
During his presidential campaign last October, Mr Trump said that the deal would not be approved “in my administration because it’s too much concentration of power in the hands of too few”.
In its lawsuit, the Department of Justice said the merger would give AT&T the power to force rival pay TV companies to pay “hundreds of millions of dollars more” for Time Warner content.
It also said the combination would also hurt the emergence of new online television options and denied that political influence played a role.
Mr Delrahim, who was appointed by President Trump and confirmed in September, gave a hint of his intention last week.
In a speech, Mr Delrahim said he did not favour the remedies the anti-trust department has used in the past to curb anti-competitive behaviour.
He said agreements that allow deals to go ahead, but require ongoing monitoring by the Department of Justice are overly intrusive and hard to enforce.
That so-called behavioural approach was used in 2011 the department allowed Comcast to take over NBCUniversal.
‘Radical and inexplicable’
AT&T denied that the deal would lead to higher charges and said it had been willing to negotiate.
AT&T’s general counsel David McAtee, said: “Today’s DOJ lawsuit is a radical and inexplicable departure from decades of antitrust precedent.
“Vertical mergers like this one are routinely approved because they benefit consumers without removing any competitor from the market. We see no legitimate reason for our merger to be treated differently.”
Mr McAtee added: “We are confident that the court will reject the government’s claims and permit this merger under longstanding legal precedent.”
Previously, US media reported that the Department of Justice was pushing AT&T to sell some of its assets as a condition for approval. The options included Turner Broadcasting or its satellite network.