The gunman was disarmed by two or three campus police officers who entered the building after responding to an emergency call, campus Police Chief Jeff Baker said.
Sandy D'Elousa, a spokeswoman for the Charlotte-Mecklenburg Police Department, which is leading the investigation, said the gunman was believed to have acted alone.
North Carolina's Governor Roy Cooper called the incident a tragic day for the university and the state just a few days before graduation. "But I know the people in this community, and they will be here for each other," he told a news conference.
According to its website, the University of North Carolina at Charlotte has more than 26,500 students.
The deadliest mass shooting on a higher education campus in the United States took place at Virginia Tech University in Blacksburg, Virginia, in April 2007, when a student killed 32 people and then himself.