Middle English: via Old French from Latin humor 'moisture', from humere (see humid). The original sense was 'bodily fluid' (surviving in aqueous humour and vitreous humour); it was used specifically for any of the cardinal humours (sense 3 of the noun), whence 'mental disposition' (thought to be caused by the relative proportions of the humours). This led, in the 16th century, to the senses 'mood' (sense 2 of the noun) and 'whim', hence to humour someone 'to indulge a person's whim'. sense 1 of the noun dates from the late 16th century
Remember that humour ends with -our (the spelling humor is American).