John Gavin, U.S. ambassador to Mexico, was born in Los Angeles. An article Tuesday incorrectly stated his place of birth.

John Gavin, the outspoken U.S. ambassador to Mexico and fervent defender of administration policies in Central America, resigned abruptly yesterday, saying that he was leaving "to return to the private sector and explore new challenges."

Like the president he served, Gavin is a former actor who turned to politics and became a hero to conservatives. Last year nine conservative U.S. senators appealed successfully to President Reagan to retain Gavin, one of a group of political appointees that State Department officials had intended to replace or rotate.

Gavin announced his resignation, effective May 15, to several hundred embassy officials and reporters in Mexico City, reading a letter he had sent to Reagan declaring he had "accomplished the major tasks you set for me." Later in the day he talked to the president by telephone.

White House Deputy Press Secretary Edward P. Djerejian said Gavin was "under pressure to stay" from Reagan, who in their conversation praised the ambassador for doing "a great job" during his five years in Mexico.

While the timing of the resignation, a day before Gavin's 54th birthday, caught administration officials by surprise, friends of the ambassador said he had been talking about leaving for some time.

Republican political sources said that Gavin earlier this year actively explored running as a GOP candidate for the U.S. Senate in California but decided against it because the field is heavily crowded.

While foreign policy professionals complained at the time of his appointment that Gavin was unqualified for the Mexican ambassadorship, his defenders pointed out that he had been born in Mexico, spoke fluent Spanish and held a degree in Latin American economics from Stanford University.

But he quickly became controversial in Mexico, where his friendship with Reagan "made him something of a lone wolf who was resented by more orthodox diplomats at State," according to a U.S. official.

Robert McCartney of the Washington Post Foreign Service reported from Mexico City that "the Mexican media and some Mexican government officials criticized Gavin for his frequently outspoken comments about Mexico."

At a Feb. 6 news conference, Gavin implicitly criticized the Mexican government over its handling of the case of Enrique Camarena, a U.S. drug enforcement agent murdered in Mexico in 1985. Gavin also was outspoken in behalf of administration attempts to provide military aid to the anti-Sandinista rebels, which the Mexican government opposes.

Gavin was also controversial at the White House, where he was defended by former national security affairs adviser William P. Clark, a high school classmate, and opposed by Michael K. Deaver, Reagan's closest aide until he resigned to become a high-paid Washington lobbyist.

Last week New York Times columnist William Safire said that Deaver, while still in the White House, tried to persuade Gavin through an intermediary to quit and was "hotly refused" by the ambassador. Deaver, whose present clients include the Mexican government, was unavailable for comment yesterday.

Lawrence Birns, director of the Council on Hemispheric Affairs, a liberal organization, yesterday criticized Gavin for "flagrant interference in the domestic affairs of Mexico" and said he should be replaced by a career diplomat