SAN FRANCISCO — The “knowledge transfer sessions” started a few months after Jeff Tan received notice last summer that he and about 80 co-workers would be laid off by the University of California, San Francisco, at the end of February.

At daily two-hour meetings with employees from HCL Technologies, an Indian tech services company that had landed the outsourcing contract from U.C.S.F., Mr. Tan trained HCL staff members in India by videoconference and employees brought to the United States on H-1B visas how to do his job.

More than any other industry, tech companies depend on the 85,000 foreign workers allowed into the United States annually under the H-1B visa program. The H-1B is a temporary visa intended to bring in foreign professionals with college degrees and specialized skills to fill jobs when qualified Americans cannot be found. Technology giants like Microsoft and Google have pressed for increases in the annual quotas, saying there are not enough Americans with the skills they need.

But for tech workers like Mr. Tan, the program has had very negative consequences.

“I thought the purpose of H-1B visas was to give America a competitive edge, not help companies ship American jobs abroad,” said Mr. Tan, who had worked for the university as an information technology systems administrator for 20 years. “This is now standard practice in the technology industry.”

The debate over H-1B visas has gained new urgency as employers prepare for President Trump to sign an executive order to overhaul the program. It is not clear what action Mr. Trump plans to take, but a draft of a proposed executive order on the matter was leaked last week. It included a passage saying options for modifying the H-1B program would be considered to “ensure that beneficiaries of the program are the best and the brightest.”

The H-1B program’s critics say the system provides a way for American companies to turn over technology departments to outsourcing companies. These are gaming the system to snap up the visas so they can replace American workers with less expensive, temporary staff members.

A research report by Goldman Sachs estimates that 900,000 to a million H-1B visa holders now reside in the United States, and that they account for up to 13 percent of American technology jobs.

In 2014, 13 outsourcing firms accounted for one-third of all H-1B visas. They use a loophole in the current first-come, first-served lottery system to flood the applicant pool with their candidates. In many cases, those candidates are paid slightly more than the $60,000-a-year minimum salary required by the program — but less than what American technology workers make.

Audrey Hatten-Milholin, 54, was notified in July that she would be laid off from the University of California, San Francisco, at the end of February after 17 years in its technology department. Along with eight others, she filed a complaint in November with California’s Department of Fair Employment and Housing, charging that replacing her and others with “significantly younger, male” workers “who will then perform the work overseas” was discriminatory.

“We are at a disadvantage as Americans,” Ms. Hatten-Milholin said. “They look at it like, where can we get it cheaper? And for U.C., it’s not here.”

Proponents of the H-1B system argue that it is an important vehicle to attract top talent to America. After coming to the United States, these visa holders may apply their skills to start new companies or create new, innovative products — leading to more jobs in America.

The debate over who wins and who loses as a result of the H-1B visa program echoes similar discussions of how free trade helps or hurts the economy. While the benefits are spread broadly throughout the economy, the costs are much more concentrated and easy to identify.

In other words, it’s true that cheaper labor helps employers increase profits and grow, and having more skilled workers in the United States contributes to economic innovation. But at the same time, individual American employees do face more salary pressure from newcomers who will work for less. And in some cases, they risk losing their jobs entirely, especially older employees who earn higher salaries.

After 11 years working in the I.T. department of Northeast Utilities, a Connecticut-based company now named Eversource Energy, Craig Diangelo was among 220 employees laid off in 2014. Before leaving the company, he was told he needed to train his replacement if he wanted to receive his severance.

Mr. Diangelo, who is now 64 and was receiving $130,000 a year in salary and bonus, said he trained an employee from the Indian outsourcing firm Infosys who was an H-1B visa holder making $60,000 a year. There was also a team of workers in India making $6,000 a year that shadowed him on the computer.

“The problem,” he said, “is that my job is still there. I went away. The American worker went away.”

A representative of Infosys declined to comment. Al Lara, a spokesman for Eversource Energy, said in a statement: “We made changes to our I.T. department three years ago during a period of transition and change to support the merger of our two companies while under much regulatory scrutiny. We are proud of the new I.T. organization.” Mr. Lara was referring to a merger with NStar in 2012.

In other instances, the jobs are filled only temporarily by H-1B workers — before the outsourcing firm moves the job permanently to a lower-cost country.

“That’s the endgame,” said Sara Blackwell, a lawyer representing former employees of Walt Disney Company, Abbott Laboratories and other companies in discrimination claims pertaining to tech-job outsourcing.

Some economists are skeptical about the claimed lack of qualified workers, especially an oft-cited 500,000 open positions in technology that cannot be filled.

“I’m sure employers might not have as much choice as they would like, but if the shortage story were true, we’d see wages rising more rapidly than they are,” said Dean Baker, co-director of the liberal Center for Economic and Policy Research in Washington. There is substantial unemployment, Mr. Baker said, even among workers in so-called STEM (science, technology, engineering and math) fields.

Lawrence F. Katz, a prominent labor economist at Harvard, said companies like the H-1B visa program because it expands the pool of applicants. That means having to pay less in salary and retaining more control over employees.

“From the point of view of an economist, there are two big winners,” he added. “The workers who come here with H-1B visas and the companies that employ them.”

While it remains to be seen what Mr. Trump will do, various members of Congress have proposed measures to change the H-1B system. One idea is to raise the minimum salary of an H-1B worker to $100,000 or more from the current $60,000 minimum. The hope is that this will narrow the gap between the standard pay for an American tech worker and that of a foreign worker.

Another proposed measure is to change the current first-come, first-served lottery system that is benefiting outsourcing firms. Yet another idea is for a salary bidding system, in which companies bid on what they would be willing to pay an applicant, potentially making it more difficult to flood the applicant pool with lower-cost workers.

According to the University of California, San Francisco, technology costs to run U.C.S.F. Health, which encompasses the university’s hospital, medical center and patient care facilities, have tripled from 2011 to 2016. Outsourcing technology jobs will save the university more than $30 million over the next five years.

But this argument has not spared the university from criticism for outsourcing the jobs because — as a public institution — it receives taxpayer funds and is a nonprofit organization.

The university said neither it nor HCL would replace the laid-off employees with H-1B workers, although it acknowledges that HCL brought in some H-1B workers initially to understand the institution’s technology needs. Those workers, U.C.S.F. said, are no longer working on the account.

Mr. Tan, 55, said he was not worried about returning to the job market in a few weeks and understood why the university took such measures. However, he is concerned about what his children will do when they start looking for work.

“Today it’s me, but tomorrow it’s going to be a doctor or an engineer,” he said. “At what point do you draw the line?”