Modifying an Xbox 360 is not illegal in itself. However, doing so carries real risks: Microsoft can detect modified consoles and ban them from Xbox Live.
If you decide to go ahead, buy from a reputable source and understand that a ban could mean losing online access. Weigh the trade-off carefully, since a banned console loses much of its value for online play.