No children, staff or officers were hurt in the shooting that took place at about 8.45am local time, police said.
The man entered the lobby of the sports centre with a handgun and fired a shot during a discussion with a staff member, Duncanville assistant police chief Matthew Stogner said. The gunman then proceeded to try and enter a classroom where children aged 4 to 14 were inside, but the door was locked.
He fired one shot into the classroom door and went to the gym, which also had children inside, the police said.
Armed officers then arrived at the camp and identified the gunman, who was in the gym, and exchanged gunfire. He was shot by the police and later taken to a hospital where he was declared brought dead.
All the children were moved out of the sports centre to a nearby recreation centre for reunification with their parents.
Naomi Rodgers, a camp counsellor, said that she was working with about 40 children who were about to play a game when they heard the gunshot.
“We had to move them all across the room because the building is glass and we had to find a safe space,” Ms Rodgers told NBC5. “The shooter actually came to our door … and he said if we didn’t let him see who he wanted to see he was going to shoot the place up.”
An investigation into the incident will be led by the Texas Department of Public Safety since the shooting involved a police officer.
Mr Stogner added that in the wake of the Uvalde mass shooting, where a teenager killed 19 children and two teachers at an elementary school, police officers at the department had to undergo active shooter training and “did exactly what they were trained to do”.
“We obviously understand what took place south of us,” Mr Stogner said. “I can only talk about how we responded here and we did an exceptional job.”