From Old English 'butan' (by-outside) — journeyed from spatial 'outside' to 'except' to adversative 'however.'
Used to introduce a phrase or clause contrasting with what has already been mentioned; except, apart from.
From Old English 'būtan' (without, outside, except, unless), a compound of 'be-' (by) + 'ūtan' (outside, from 'ūt,' out). Literally 'by-outside,' meaning 'on the outside of, except for.' The adversative conjunction sense ('I tried, but failed') developed from the exceptive sense: 'everything except this' became 'however, this.' The same word
In Scots English, a 'but and ben' is a two-room cottage: the 'but' (outer room, from 'by-outside') and the 'ben' (inner room, from 'by-inside'). The conjunction 'but' literally means 'on the outside of' — when you say 'all but one,' you mean 'all, with one on the outside.' The adversative sense grew from this idea of exception