No, it is not illegal to play an 18-rated game. Age ratings are guidance about suitable content rather than laws against playing, so enjoying one is perfectly fine.