Kilowattrel appears in 4-Star Raids and up. Starting at 3-Star Tera Raids and up, Tera Bosses can use moves outside they’re movepool.
A 3★ and above Tera Pokémon may use additional moves outside of their moveset and standard turn order, once their HP or the remaining time falls below certain predefined thresholds. They will not know these moves when caught.
So your Tera Raid Kilowattrel probably used Rain Dance as an extra move outside its standard moveset. These extra moves cannot be kept when the boss is captured. Hope this helped!
Source