Mentality describes a characteristic way of thinking, and usually carries a critical edge — "a siege mentality", "a herd mentality". Mindset is more neutral and is generally treated as something adjustable: "a growth mindset". Both name habits of thought; only one tends to be an accusation.
The core difference
Near-synonyms separated mostly by connotation.
- mentality — an established way of thinking, often disapproved of: a bunker mentality.
- mindset — an attitude or frame of mind, often discussed as changeable: shift your mindset.
Why mindset became the popular word
Because it is used in contexts about improvement — coaching, education, management — where the point is that thinking can change. The fixed-versus-growth mindset framing in education psychology carried the word into general use. Mentality resists that, because calling something a mentality tends to present it as entrenched.
Choosing
If you are describing a group's entrenched attitude critically, mentality fits. If you are describing an attitude someone could adopt or change, mindset is the natural word.