Crab mentality is the mindset of trying to put people down because they are more successful than you.
This can come in the form of spreading gossip, mistrusting people, or even creating schemes to bring them down, just because they got ahead of you.
People like these are likened to crabs, who, after getting caught and put in a pail, try to reach out to freedom. But as other crabs reach the top, they are being pulled by their fellow crabs.
Crab mentality is a perfect metaphor or envy. Instead of working together to both be successful, we choose to work alone, and be successful alone.