The University of Maryland has had to tighten its belt, cutting seven varsity sports teams and forcing faculty and staff to take furlough days. But in a corner of the campus, construction workers are building a dormitory specifically designed for a new academic program.

Many of the students who live there will be enrolled in a cybersecurity concentration funded in part by Northrop Grumman Corp. The defense contractor is helping to...