These words are their own opposites
Many people—native-speakers and learners alike—decry English as being illogical, and they point to pairs like flammable and inflammable as examples. But there are other words that are just as frustrating: Janus words.
Frequently described as "words that are their own opposites," Janus words are also known as contronyms, antagonyms, or auto-antonyms. These are words that have developed contradictory meanings. Cleave is often cited as the go-to contronym: it can refer to splitting something apart and uniting two things. But it's not the only one out there, and there is usually some sort of logic behind most auto-antonyms.
Many auto-antonyms developed their contradictory meanings through a process of semantic broadening; that is, a word that has a more specific meaning gains a broader and more general meaning later on in its life. Peruse is a good example of this.
The inverse also happens: a word that begins life with a broad meaning gains a number of more specific meanings that develop in parallel to each other, but in a way that results in two contradictory and later meanings. Sanction is one such word. When it entered English, it referred to an oath. Over time, it came to refer to something that would compel someone or something to moral behavior (as an oath might); later, it gained the two contradictory senses that refer to approval and economic disapproval—both of which might compel a person or a country to behave better.
The same thing happened with oversight. It originally referred to watchful care or supervision, but through an extension of meaning, people also began to use it to refer to the thing that watchful care or supervision gets rid of: errors of omission. As with sanction, both meanings are still in use today, leading to plenty of jokes about what exactly "Congressional oversight" is describing.
Sometimes, a contronym develops because we conflate two homographs which are not actually related. This is the case with cleave, which is actually two separate verbs: one which means "to split" (from the Old English verb cleōfan, which means "to split"), and one which means "to adhere firmly or loyally" (from the Old English verb clifian, which means "to adhere"). The same goes for clip, whose contronymous meanings are actually from two discrete verbs that mean "to attach something" and "to cut off."
Occasionally, we can't be sure why exactly a word develops auto-antonymous meanings. Take fast, which can refer both to moving very quickly ("a car moving really fast") and to staying put ("he was held fast by the ropes"). The "firmly fixed" meaning is the earliest meaning we have for the adverb fast. It later developed other meanings, including "close"—and this meaning, which has now fallen out of use, somehow inspired English speakers to use fast to refer to speed. Fast has been its own antonym since the 13th century, which goes to show that Janus words have been with us—and will continue to be with us—for a long time.