In Thai, they use ‘chaiyo!’ [ไชโย] for cheers. Thai has borrowed a lot of vocabulary from Sanskrit and Pali, and ‘chaiyo’ is likely derived from the Sanskrit verb ‘jayati’ meaning ‘to win’. If the Mandarin term was borrowed from the same source (also likely in my view), it could have been written with various characters down through the centuries. The current 加油 would then be a kind of rationalization in order to make a foreign word seem native.
A more specific conjecture about the source form:
Pali, the language of the Theravada Buddhist scriptures, has the following:
imassa jayo bhavissati 'Victory will be his.'
Jayo here is a deverbal noun in the nominative case: ‘victory.’ The form in Sanskrit would be identical in this context. As Sanskrit broadly speaking is the language of the Mahayana scriptures, this would most likely be the source for the Chinese word. 加油 is thus a transliteration, where the characters were chosen for their sound, not their meaning. Interpreting this as ‘add oil’ etc. is what linguists call folk etymology.