The NATO summit, scheduled immediately following the G-8, will still be held in Chicago, officials said in the surprise announcement from the White House.
"In May, the United States looks forward to hosting the G-8 and NATO Summits. To facilitate a free-flowing discussion with our close G-8 partners, the president is inviting his fellow G-8 leaders to Camp David on May 18-19 for the G-8 summit, which will address a broad range of economic, political and security issues," the White House statement said.
"The president will then welcome NATO allies and partners to his hometown of Chicago for the NATO Summit on May 20-21, which will be the premier opportunity this year for the president to continue his efforts to strengthen NATO in order to ensure that the Atlantic Alliance remains the most successful alliance in history, while charting the way forward in Afghanistan."
Chicago Mayor Rahm Emanuel had lobbied Obama to host both summits.
Emanuel's office said the mayor wished Obama and the other leaders well at the G8 meeting at Camp David, the Chicago Tribune reported.
"Hosting the NATO Summit is a tremendous opportunity to showcase Chicago to the world and the world to Chicago and we are proud to host the 50 heads of state, foreign and defense ministers from the NATO and ISAF countries in our great city May 19-21," the mayor's office said in a statement.
As many as 10,000 demonstrators were expected to be in Chicago for the overlapping summits, Chicago police said.