On the TV show Lucifer, why was the role of Chloe's ex husband recast?
In the pilot he was played by a different actor to the full series. The new actor is shown in this picture.
I assume you're asking about the fact that Nicholas Gonzalez played Dan in the pilot episode, while Kevin Alejandro has played him ever since.
That's not unusual. Pilot episodes are usually filmed well in advance of the rest of the series, and studios make numerous changes (tone, characters, etc.) as part of the deal to get them picked up to series.
In this case, no explanation was given why the role was re-cast, but it was announced last summer that the cast change had happened, e.g. here. Deadline does note that Alejandro "recently became available", so perhaps the studio just thought he fit better; perhaps test audiences didn't like Gonzalez or he didn't play well against Lauren German. We'll probably never know.
No reason for Gonzalez’s exit was given, and it sounds like his part in the pilot will remain intact despite the role swap.
Alejandro, repped by Gersh, Main Title and Hansen Jacobson, just recently became available, coming off the A&E drama The Returned. He previously was a regular on True Blood, Southland and Golden Boy.