Mexico were beaten 3-1 by Argentina in the last-16 in Johannesburg on Sunday.
“I have to leave, it’s the most honest thing to do,” said Aguirre.
The 51-year-old replaced Sven-Goran Eriksson as Mexico coach in April 2009.
“Everything I did, I did thinking of the well-being of Mexico,” added Aguirre.
“I’m the person responsible. The plan was to be among the best eight in the world.
“We didn’t qualify for the next round, and because of this one can consider it a failure.”