The lawsuit cites the US constitution's emoluments clause, which says no federal official should receive a gift or a fee from a foreign government.
The suit claims Mr Trump is "flagrantly violating the constitution", Washington DC's attorney general said.
It is the first such lawsuit filed by government entities.
"Never in the history of this country have we had a president with these kinds of extensive business entanglements or a president who refused to adequately distance himself from their holdings," Karl Racine, the District of Columbia attorney general said while announcing the lawsuit alongside Brian Frosh, Maryland's attorney general, on Monday.
A non-governmental organisation, Citizens for Responsibility and Ethics in Washington, lodged a similar legal action in January.
The Justice Department on Friday said those plaintiffs did not suffer in any way and there were no grounds for the suit. The department also said it was unconstitutional to sue the president in his official capacity.
Mr Trump has not yet commented on the latest move.
The constitutional challenges to Donald Trump's ongoing business ties as president just got some state-level muscle behind them.
While the lawsuit by the District of Columbia and Maryland isn't the first attempt to force the president to more fully separate himself from his real-estate empire, the two governments bring a new level of legitimacy and resources.
The first hurdle the states face is whether they have the proper legal grounds to file this case. Given that this is judicial terra incognita, there's no telling how the courts will react.
There's never been a businessman-turned-president quite like Mr Trump, so there's never been a lawsuit quite like this one.
If Maryland and DC are able to proceed, the case could turn out like many other Trump-related controversies, where the president's own words - and those of his associates - are used against him. While Mr Trump pledged to extricate himself from his day-to-day business operations, his son Eric has acknowledged he still gives his father regular financial updates. Senior adviser Kellyanne Conway also was recently reprimanded for praising daughter Ivanka's clothing line.
Even in a best-case scenario for the president, this represents the latest in a growing list of legal headaches.
Mr Trump is already contending with inquiries by congressional committees and a special prosecutor into his campaign's alleged links to Russia, which American intelligence agencies accuse of meddling in last November's US election in a bid to boost support for the property developer.
Since taking office in January, Mr Trump has turned day-to-day control of his real estate empire and other assets over to a trust managed by his adult sons.
But he has not sold them off as critics said he should do in order to avoid conflicts of interest.
"The emoluments clauses are a firewall against presidential corruption and the one thing we know about President Trump is he understands the value of walls," Mr Frosh said, referring to the president's plan to build a wall along the US-Mexico border.
"This is one he can't climb over and one he can't dig underneath."
The lawsuit will ask for a court injunction blocking Mr Trump from accepting foreign money.
A list of Trump's potential conflicts
The lawsuit is also seeking to access to his personal tax returns as part of the legal process known as discovery, according to US media.
A key case in the dispute is Trump International Hotel in Washington DC, just down the road from the White House.
Mr Trump opened the business last year by leasing a large building that used to be a central post office.
The Trump Organization has said it would donate profits from customers who represent foreign governments to the Treasury department, but will not require those customers to identify themselves.
According to the Washington Post, the lawsuit will detail examples of foreign governments favouring the president's hotel over others.
It will cite how the Kuwaiti embassy planned to hold an event at a Four Seasons hotel, but eventually chose Trump International as the venue.
Maryland and Washington are expected to argue that the Trump hotel also hurts competing hotels in their jurisdictions.
The legal action will refer to Mr Trump's international hotels, golf courses and other commercial properties.
The president's lawyers have argued the emoluments clause is intended only to stop federal officials from accepting a special consideration or gift from a foreign power and does not apply to payments such as a bill for a hotel room.
Monday's other Trump news
Trump travel ban in fresh court defeat
Ivanka Trump condemns 'vicious' critics
Sessions to testify publicly on Russia
Trump-like Julius Caesar loses backing
Trump targeted at Spacey-hosted Tonys
Officials in Maryland and Washington DC are suing Donald Trump for accepting payments from foreign governments via his business empire.