The word "but" is a conjunction used to indicate contrast or an exception. It connects two clauses, showing that the second clause slightly contradicts or goes against the first one. For example, in the sentence "I wanted to go for a walk, but it started to rain," the word "but" signals that the rain prevents the first part (wanting to walk) from happening.
The word "but" comes from Old English "butan," which means "outside of" or "except." It has Germanic roots, with similar forms in Dutch and German.