The House Commerce Committee gave some support to President Carter's hospital cost containment bill yesterday, narrowly beating back two amendments that bill sponsor Henry Waxman (D-Calif.) charged would "gut" the legislation.

On a 21-to-21 vote, the committee rejected a proposal by James T. Broyhill (R-N.C.) to make the cost containment program voluntary, wiping out the bill's mandatory controls for hospitals failing to meet voluntary cost limitation goals.

Then it beat back, 22 to 20, an amendment by Richard C. Shelby (D-Ala.) to allow higher cost increases before putting mandatory controls in place.

Broyhill, Shelby, Dave Stockman (R-Mich.) and others argued that the complicated mandatory system and triggering mechanism could spawn a horde of government bureaucrats with volumes of federal regulations on hospitals all over the country.

But Waxman said both amendments would simply wipe out any threat of government sanctions and thereby undermine existing voluntary efforts. "This is a way of killing the bill, by saying there will be a voluntary program which we will study," Waxman said before the Broyhill vote.

In the last Congress, the Broyhill amendment won in the Commerce Committee and the bill went nowhere.

President Carter has made hospital cost containment one of the handful of key legislative requests this year. Four committees have jurisdiction.

Under the bill, if hospitals nationwide do not voluntarily limit average increase in costs to a figure specified by a formula (11.6 percent for 1979), then mandatory controls on hospital revenues will be imposed by the government.

The Department of Health, Education and Welfare estimated that the administration's original proposal would save consumers and U.S. agencies $53 billion the next five years. The Waxman substitute, which HEW is backing in Commerce, would save slightly less, about $40 billion.

In the Senate, the Finance Committee has approved a different bill sponsored by Herman Talmadge (D-Ga.), with far lower savings. The Human Resources Committee has approved a variation of the Carter bill sponsored by Edward M. Kennedy (D-Mass.).

In the House, Ways and Means has approved a cutback Carter plan estimated to save $31 billion over five years. The Waxman bill is about half way between the original Carter plan and the Ways and Means bill.

According to American Hospital Association annual surveys, hospital costs rose 19.4 percent in 1975, 16.1 percent in 1976, 14.2 percent in 1977 and 12.6 percent last year. The slower rate in the last year reflects a voluntary industry cost containment effort started after Carter's mandatory proposal was announced two years ago.

The hospital and health industry -- whose lobbyists were mobbing the room yesterday -- are massed against the mandatory plan.

House Speaker Thomas P. (Tip) O'Neill Jr. (D-Mass.) has said that if Commerce does not report out a bill, he will simply bring the Ways and Means measure to the floor, so defeat for the bill in Commerce would not prevent floor action. But supporters of the bill will be in a much stronger position to pass it on the floor if they can bring it up with the endorsement by both committees.