PHOENIX—When students returned to Phoenix Union High School District schools this week, most of them were wearing masks, following the district’s rules—which go against Arizona’s ban on mask mandates.

Superintendent Chad Gestson said he would enforce a mask mandate as long as it is recommended by health agencies and as long as it is needed because of Covid-19 case rates in the area. He said all of the district’s 32 ZIP Codes are in what the Centers for Disease Control and Prevention considers high or substantial transmission, according to Maricopa County data.

Under Arizona law, passed in late June, schools are banned from mandating proof of vaccinations or mask wearing. It is one of at least seven states that have outlawed the required use of masks in schools through enacted bills or executive orders.

Nearly all students were wearing masks Monday as classroom work resumed at Phoenix’s Bioscience High School.

Republican Gov. Doug Ducey’s office said that what the school district is doing isn’t allowed under state law. “Governor Ducey believes the decision by Phoenix Union requiring masks has no teeth,” his office said in a statement. “It’s unenforceable.”

Education administrators, government leaders and health officials have reached a consensus as the new school year begins that in-person learning is essential. A deep divide remains in some places, however, over mask requirements. Schools in Arizona are among the first to resume instruction, providing an early indication of how mask wearing will play out across the country in coming months as more schools reopen.

The CDC released new guidelines last week recommending indoor masking in certain parts of the country regardless of vaccination status after new data showed that vaccinated people can spread the virus. It was a shift from in early July, when it recommended the use of masks only among unvaccinated students and staff.

On Wednesday, Illinois Gov. J.B. Pritzker said students, teachers and staff at prekindergarten through 12th grade schools throughout the state would be required to wear masks when they return to the classroom in the fall. The mandate applies to vaccinated and unvaccinated people and will be required for indoor sports as well, he said. It also will apply to day-care centers.

“Without these measures, we would likely see many more outbreaks than in the latter half of the last school year,” the Democratic governor said. “Preventing outbreaks from the start also prevents kids from having to stay home because they’re sick or in quarantine.”

As reasons for the new mandate, Mr. Pritzker cited lower rates of vaccination among qualified children and teens, the inability for children under the age of 12 to get vaccinated yet and hesitancy from some districts to implement their own rules.

In Arkansas on Tuesday, Republican Gov. Asa Hutchinson urged the state legislature to adjust a law he signed barring school districts from mandating masks. He called for a special legislative session and asked that lawmakers allow school districts to determine whether to require masks to better protect children, particularly those 11 and younger who can’t yet get vaccinated.

Phoenix Union, one of the largest districts in Arizona, with about 30,000 students, cited new guidelines by the CDC when it decided to go against the state ban and require masks as it opened schools this week.

A year into the coronavirus pandemic, many schools are only partially open for fear they could fuel the spread of the virus. Experts explain what the actual risks are for spreading Covid-19 in schools and how proper controls can change that equation. Illustration: Preston Jessee for The Wall Street Journal The Wall Street Journal Interactive Edition

On Monday, the Phoenix Elementary School District announced that it would enact a mask mandate with a limited opt-out provision. Students in the district are due to return to school Thursday.

The CDC defines transmission risk based on new Covid-19 cases reported and the percentage of positive tests. A county is considered at high transmission risk with 100 or more cases in the past seven days per 100,000 people or positive cumulative test rates at or above 10%. Arizona’s transmission risk is considered high, along with 33 other states.

New reported cases have been climbing, with Sunday’s daily reading reaching 2,300. It was the second day in a row that new daily cases were over 2,000, a number the state hadn’t hit since the first quarter. About 52% of Arizonans received at least one dose of the Covid-19 vaccine as of Monday, according to state data.

On Monday, staffers waved purple pompoms and cheered on students as they walked onto campus for their first day of school at Bioscience High School in downtown Phoenix. For some students, it was their first time going to school in person in almost a year and a half. Nearly everyone was wearing a mask as students walked into a gated patio.

Dr. Holly Batsell, principal of Phoenix’s Bioscience High School, welcomed students on the first day of school.

After spending more than a year online, Yamilet Daniel Garcia, a 14-year- old freshman at Bioscience, said she felt safer returning to school with the mask requirement. “Even if it was optional, I would choose to wear it anyway,” she said.

Her mom, Adriana Garcia, said several people she knows in the community are still getting sick with Covid-19. She said the family would feel safer with Yamilet going to school remotely, but with the exception of a stand-alone virtual school, the district isn’t offering remote-learning options this year. And Yamilet was set on Bioscience.

Share Your Thoughts

What are the mask requirements like in your area? Join the conversation below.

A few people have voiced opposition to the district’s mask requirement, but the “absolute overwhelming majority of staff, students, parents and community supporters have applauded the decision,” said Dr. Gestson.

Douglas Hester, a teacher at Phoenix’s Metro Tech High School, filed a lawsuit Monday in Maricopa County Superior Court against the district, alleging that the legislature is better equipped to make the decision for how to manage the pandemic in schools, his attorney Alexander Kolodin said.

“The fact that Phoenix Union High School District is taking the product of that very deliberative legislative process and essentially using it as toilet paper is a serious threat to our Republican system of government,” said Mr. Kolodin.

Yamilet Daniel Garcia, a 14-year-old freshman at Bioscience, says she feels safer returning to school with the requirement to wear masks.

Carl Frontera, whose son is a freshman at Bioscience, said he thought it would be best if the government enforced mask requirements in Arizona schools. Mr. Frontera accompanied his son, who spent all of last year attending school remotely, to his first day of school at Bioscience.

The governor’s office didn’t specify what penalties the district could face if it continues with the mandate. The superintendent said he is unsure of the exact legal consequences the district could face.

“There are times when you have to make difficult decisions to protect human lives, and we had to say, ‘What’s worse? Potential legal consequences or human consequences?’ And we chose our people,” said Dr. Gestson.

While a few have voiced opposition to the mask requirement, the overwhelming majority of staff, students and parents support it, according to Phoenix Union High School District.

Write to Aydali Campa at aydali.campalopez@wsj.com