The biggest corporate deal of the year is dead.

AT&T ran into a buzzsaw of government opposition to its proposed $39 billion takeover of mobile company T-Mobile USA. And now the companies are throwing in the towel.

AT&T said in a statement that it and T-Mobile parent company Deutsche Telekom have agreed to drop the merger, which was first...