Casper, 54, will succeed Donald Kennedy, who is resigning amid investigations into Stanford's alleged abuses in its spending of federal research money.
Now provost at Chicago, Casper is expected to take over the Stanford presidency Sept. 1.
He was selected for one of the most prestigious posts in American higher education because of his respected academic credentials and because he is perceived as being able to lead Stanford out of its current financial and image problems, trustees and other sources said.
Because of federal cutbacks in research funding at Stanford, the 13,000-student university near Palo Alto has had painful budget cuts recently.
"Gerhard Casper is a man of tremendous intellectual breadth and depth," James C. Gaither, president of Stanford's Board of Trustees, said in a prepared statement.
"His commitment to excellence, his love for knowledge and teaching, and his appreciation of the challenges and opportunities facing the modern university make him the perfect match for Stanford."
Casper was the law school dean at the University of Chicago for eight years before becoming provost in 1989.
A naturalized American citizen and an expert on the U. S. Supreme Court, he has a law degree from Germany's University of Hamburg, a master's degree in legal studies from Yale University and a doctorate in law from the University of Freiburg in Germany.
In a telephone interview Tuesday night, Casper said his main challenge will be to improve the quality of undergraduate education at what has been a research-oriented university. That also had been one of Kennedy's goals.
"On the whole, I think (Stanford) has been doing a pretty good job at teaching undergraduates," said Casper, who retains a slight German accent. "But at research universities, there is always tension between the teaching task and the research task. I think that tension will never go away. We will always have to work at it."
Asked about allegations that Stanford greatly overcharged taxpayers for the overhead on federal research, Casper said he was not intimately familiar with the details of the university's bookkeeping.
But he added that he thinks Stanford, "with the rest of the major research universities, has come in for perhaps too much criticism, although some criticism clearly was deserved."
Defense Department auditors contend that the university may have overbilled the government during the 1980s by as much as $300 million in such indirect costs of research as building maintenance, library expenses and administration.
Stanford hotly denies the allegations. But its reputation has been tainted by the controversy and by revelations that it partly billed taxpayers for such luxuries as a yacht and antiques in its president's residence.
In January, the school announced cutbacks to help close a $43-million deficit by 1994. That $43 million represents about 12% of the university's annual $362-million operating budget, excluding its medical school and hospital. The deficit was caused in part by the drop in federal aid stemming from the investigations.
Casper was chosen after a nationwide search. Several sources said trustees decided that an outsider was needed after a tumultuous era.
Kennedy announced last July that he intended to resign by August after nearly a dozen years as Stanford's president.
In late January, Casper announced that he intended to step down as provost at Chicago, which has about 11,000 students, at the end of this academic year to rejoin the school's law faculty.
At Chicago, he was regarded as a possible successor to President Hanna Gray. He also was a finalist for the presidency of Harvard University last year.
Others considered possible finalists for Stanford's presidency included Andrew Spence, dean of Stanford's Graduate School of Business; James Gibbons, dean of Stanford's Engineering School; Michael Boskin, chairman of President Bush's Council of Economic Advisers who is on leave from his Stanford professorship; Vartan Gregorian, president of Brown University, and Wellesley College President Nannerl Keohane.