Greg Robinson, a former Texas co-defensive coordinator, will replace Diaz. Robinson had rejoined Texas in July as an analyst.
Texas allowed BYU to run for 550 yards on Saturday, including 259 yards by quarterback Taysom Hill, in a 40-21 loss.
"Our performance on defense last night was unacceptable, and we need to change that," Texas coach Mack Brown said in a statement released by the school. "Greg will be here tonight and get with the staff and players to start preparing for Ole Miss. He will be running our defense immediately. We're very fortunate that Greg has been around, watched all of our practice video and has a good scouting report moving forward."
Robinson is a former head coach at Syracuse and defensive coordinator at Michigan. He was a co-defensive coordinator for Texas in 2004.
"This is a tough deal for everyone involved, but I love The University of Texas, and Coach Brown has been wonderful to me," Robinson said in the statement. "I'll do anything I can to help him, so when he called, I told him I'd be there today. I know the staff, have a lot of respect for them and am excited for the challenge moving forward."
Diaz will be reassigned within the athletics department, the school said.
Information from ESPN's Joe Schad and Brett McMurphy was used in this report.