Why does ‘you’re on’ mean ‘I agree’?

Solution 1:

"On" is one of those words that have quite a lot of meanings, plus it is used in lots of phrases with various meanings. The meaning of on, in the term used is this (from yourdictionary):

adjective
arranged or planned for: tomorrow's game is still on

also read through all of the meanings here to try to get the feeling for the patterns.

Now, as to why "You" instead of "I" - well, usually the phrase is used to answer a challenge, and in this case it is more natural to say "You are on" because it is the challenge that has conditions that needs to be activated, accepted or started (there is some semantical overlap between the word "on" and these verbs). Also, you could have several challenges at the same time from several people - saying "I am on" would be ambiguous in that scenario, where "You are on" is not.

Solution 2:

The New Oxford American Dictionary has:

you're on: (informal) said by way of accepting a challenge or bet.