There are several ways to add a new swatch from something on the page but it doesn't work quite that way. If an object isn't selected, you can use the Eyedropper to sample its color. Then click the New Swatch button at the bottom of the Swatches panel to add a swatch.
If you have the Color panel open, you can drag a swatch from the Fill or Stroke box (upper left) onto the Swatches panel. (Or you could choose Add to Swatches) from the Color panel menu.