Check your control bindings in the Pause menu - you might have accidentally bound X to open the developer console.