First of all, Gatsby is a static site generator of React and usually we won't implement JQuery with React. If you would like to manipulate your DOM by JQuery, I think you probably could do the same by React.
Back to your question, there are several ways commonly used to include a JS file in Gatsby:
The first one is include your script in Gatsby's html.js. You can refer the documentation there:
https://www.gatsbyjs.org/docs/custom-html/#adding-custom-javascript
The second one is using React Helmet. It will let to embed head tags in your components.
https://www.npmjs.com/package/react-helmet