Similarity scores were first introduced by Bill James, in his book The Politics of Glory. It was originally created as a way to compare non-Hall of Fame players to players in the Hall, to determine who was either on track to make the Hall, or to see whether any players had been snubbed by the electors. For example, if the most similar players to a non-Hall of Famer were all in the Hall of Fame, one could effectively argue that that player should be in the Hall.
Many baseball analysts have augmented James' method over the years, or come up with their own system of measuring similarity. More recently, similarity scores have been used in many statistical forecasting programs. The logic behind this is that players often follow similar career trajectories to their most similar players, so the historical similar players' performance in years after the active player's current age should be a good predictor of that active player's future production. Baseball Prospectus' PECOTA projection system heavily relies a form of similarity scores.