NEW YORK—President Donald Trump used his family foundation to further his 2016 campaign, pay legal settlements and promote his businesses, the state attorney general here alleged in a lawsuit filed Thursday, adding to the president’s legal problems.

The lawsuit, filed in state Supreme Court in Manhattan, calls the Donald J. Trump Foundation “little more than an empty shell” and accuses it of repeatedly violating laws that govern charities. The suit, which names Mr. Trump, his three older children and the charity itself, seeks...