Question: is modding a game illegal?
Answer: It isn't illegal to mod games. Though certain stuff you can do on modded console can be considered illegal. Main example being able to download and play pirated games. Your question about modding being illegal is implying modding games being illegal and the answer to that question is no.