Gatsby is a react-based open-source front-end framework used as a static web generator, whereas WordPress is a dynamic web generator and CMS solution. For headless WordPress you will need to use a front-end solution such as Gatsby, Next or Frontity. So Gatsby and WordPress do very different things and don't compete against each other.