Many, if not all, of us have likely thought and overthought about something in our lives. These thoughts were likely preceded by a phrase like "what if ________ happens?"
The fact of the matter is that there are going to be things that happen in your lifetime that you just don't have a say over the outcome of. And that is why it is so important to focus only on what you CAN control.
Yes this is more easily said than done, but by only worrying about things you can control you can minimize the stress in your life. If you are constantly worrying/thinking about what other people may do or think, you are adding unnecessary stress. You will never be able to control how other people act or react, but you can always control your own actions/reactions.
To bring this mentality into the gym, lets think about strength or speed. You can't control how much someone else lifts, or how fast they complete a timed set. So stop worrying about that person on Instagram who can lift more than you. Instead focus on what you can control - things like your own attitude and effort level, things that will effect your own performance.
Again this is easier said than done, especially in a world where we are reminded of what other people are doing every time we look at our phone. But like anything else, the more you practice it the better you will become at it.