JavaScript (ES6), 24 bytes
Note that it works because Set
is guaranteed to maintain the insertion order of its elements.
s=>[...new Set(s)].pop()
Commented
s => // s = input string
[... // turn into an array ...
new Set(s) // ... the set generated from s
// e.g. "BANANA" -> Set {'B','A','N'}
] //
.pop() // return the last element