But and however are both used with a contrasting ‘unexpected’ clause.
I don’t like him, but I agree that he is a good manager.
I don’t like him. However, I agree that he is a good manager.
Note the difference now.
But is a conjunction. It joins two clauses, and comes at the beginning of the second.
Example: He was telling the truth, but (second clause) the police didn’t believe him.
However is an adverb. It does not connect its sentence grammatically to the one before. That’s why it comes after a full stop or a semi-colon. Also, however can go in various positions. It’s separated from its sentence by one or two commas depending on its position.
He was telling the truth. However, the police did not believe him.
The police, however, did not believe him.
The police did not believe him, however.