McGinn is the highest profile challenger to come forward before the May 19 filing deadline.
He'll challenge Ed Murray, who defeated him in 2013.
Heckard was identified only by his initials in the original lawsuit filed earlier this month against Murray.
McGinn, who was mayor from 2010-2014, announced his candidacy Monday.
The Seattle Times reported that a letter from Heckard's lawyer Lincoln Beauregard to Murray's attorney states that the decision to go public was so Murray could no longer claim that he doesn't know who "D.H." is.
"The people who helped make this city what it is, made it so attractive, are the people being pushed out by the growth", McGinn said.
An environmental and neighborhood activist and former state chair of the Sierra Club, McGinn spent his term advocating for increased bus and bike lanes-critics dubbed him "Mayor McSchwinn"-and against the Alaskan Way Viaduct replacement tunnel megaproject".More news: 6 things the Samsung Galaxy S8 tells us about audio and video
At a news conference, Murray said he continues to run the city and his re-election campaign.
He was also famously opposed to the waterfront tunneling project, a stance for which he was ridiculed at the time. Voters ended up supporting the tunnel, dealing McGinn a significant political blow, though the tunnel boring machine later broke down, causing significant cost overruns.
"It wasn't very long ago that we were anxious about attracting downtown employers", McGinn said. The city's downtown businesses supported the panhandler ordinance, saying people felt unsafe. Ultimately, Seattle agreed to an independent monitor of the city's police department following a report that found officers routinely used excessive force.
"We believe that the people of Seattle do not want to return to those bad old days", the statement said.
The mayor also said he has never paid for sex and has never had sex with a minor.
Incumbent Ed Murray and six other candidates for mayor will answer questions at a panel in North Seattle Thursday night, the first public forum for this race since two well-known Seattle leaders announced their campaigns this week.
At the news conference Monday, McGinn said the lawsuit is one reason for his announcement now.