Only certain games are playable online. You can tell if a game has that ability by looking for a blue wi-fi sticker on the cover of the game's box. Once you've purchased one of these games, you simply select wi-fi mode for that game, then you can either play against a random opponent, or you can trade friend codes [for that game] with a friend and play against them.