The gods wanted to avenge Balder, and that had to be done by a brother of Balder. Therefore, Odin had a son with a jotun woman, and here’s where Vali comes in.