subject marker; however; but
が marks the subject of a sentence and can also mean 'but' when used at the start of a clause.
が is a particle with two main jobs. First, it marks the subject of a sentence, especially when the subject is new information or when it follows a question word like 誰 (who) or 何 (what). For example, in '誰が来ますか' (Who is coming?), the answer would be '田中さんが来ます' (Tanaka is coming). In contrast, は marks the topic, which is already known or general. So が often highlights the specific subject.
Second, が can be used as a conjunction meaning 'but' or 'however'. It attaches to the end of a clause to contrast it with the next clause. For example, '食べたが、まだお腹が空いています' (I ate, but I'm still hungry). This usage is common in both speech and writing.
Note that が is also a question particle (like at the end of a sentence to ask for confirmation), but that is a different grammar point. Here we focus on the subject marker and the 'but' meaning.