What part of speech is “they”?

They is a pronoun. Specifically, it’s the third-person plural subject pronoun. That means it’s used in the subject position to refer to a group of two or more people or things, as in the sentence “They went out ten minutes ago.”

The singular “they” is a term for the use of the word as a singular pronoun. In this usage it can be classed as a third-person gender-neutral (aka epicene) singular pronoun. It’s used to refer to an individual of unknown or nonbinary gender, as in the sentence “They are a friend of mine.”