Why 15 30 40 for a game?

The scoring is based on the scoring rules of real tennis. Real, here, refers to royal as opposed to fake. I real tennis, the scores were 15, 30 and 45 but the last got shortened to 40 in the "new" game of lawn tennis.

Read more on real tennis at link.