A comma (,) is a punctuation mark commonly used to introduce a pause and separate elements in a sentence or paragraph. However, this punctuation mark follows strict grammar rules, that include using a comma to separate different elements in a list; placing a comma before coordinating conjunctions such as and, but, or, yet, so; using commas to separate the elements in dates; among others. Considering the sentence "Hamlet becomes a tragic hero but Macbeth becomes a villain" includes one coordinating conjunction which is "but" according to grammar a comma needs to be placed before this word which means the correct sentence would be "Hamlet becomes a tragic hero, but Macbeth becomes a villain". Thus, a comma needs to be added before the word but or after the word hero.