When the significance of a word evolves and departs from its original meaning this is often referred to semantic change or semantic shift.
For example, awful
Awful—Originally meant "inspiring wonder (or fear)". Used originally
as a shortening for "full of awe", in contemporary usage the word
usually has negative meaning.
Not exactly opposite in meaning but nevertheless its history illustrates how a word can change its meaning totally
Gentle was borrowed in Middle English in the sense of ‘born of a
good-family, with a higher social standing’. Later the sense
‘courteous’ and then ‘kind, mild in manners’ developed because these
qualities were regarded as qualities of the upper classes.
The author, Raymond Hickey, then goes on to explain
BAD MEANINGS REPLACE GOOD MEANINGS Pejoration is more usual than amelioration, i.e there are more instances of words developing a
negative meaning than the opposite case. ... The word churl stems from a Germanic root meaning
‘man’ and came to mean ‘a peasant, someone of low birth’ and later
still ‘an ill-bred person’. The root is still to be seen in the
adjective churlish ‘mean, despicable’.
Scroll to the end of the page, whereupon a short list of linguistic books handling the subject of semantic change are recommended.
Semantic change as discussed on the website, Studying the History of English.