WWE is in the intellectual property game, and they’re very good at it. They have tons of names under their ownership that they might never use. The important part is that the company owns them so nobody else can use them.
WWE released several Superstars on April 15th. Karl Anderson and Lio Rush were a part of those releases. The company has transferred ownership of trademarks over to those former Superstars.
According to Heel By Nature, Lio Rush and WWE reached an agreement on July 22nd to transfer his ring name to him. This agreement was finalized on August 2nd and it allows Rush to use that name in any way he likes.
Karl Anderson and WWE also reached a deal to transfer the rights of his name back to him. This agreement was reached on May 27th and it was finalized on June 24th. Since then, Anderson and Doc Gallows both signed with Impact Wrestling.
This should clear up any confusion as to why Karl Anderson and Lio Rush were able to take their names with them. Those were also the names that they were using prior to entering WWE, so it also makes sense in that regard.