"Just relax" is a myth built on the foundation of science and positive bias.
Science – studies have shown that people with high cortisole and all the annoying stuff that tends to go along with stress tend to be less likely to fall pregnant, but there's zero nuance in the way that data is presented outside of the original study papers. Articles that report on these studies, for one example, don't usually go into detail about how/whether the fertility-reducing factors are confirmed as being created by stress (there can be other factors, e.g. dietary, lifestyle, underlying health conditions).
Positive bias – stories of people who fell pregnant after they claim* they stopped trying (the implication being that this relaxed them) can make the myth seem more believable. This is called positivity bias, which is when people are more likely to report a positive outcome than a negative one, which doesn't actually tell you which is more frequent.
I personally don't like the phrase, not just because I believe it's wrong, but also because it suggests to me that infertility is the fault of the people suffering it and that they personally have control over it, which is almost never the case. I get wanting to feel like it's controllable because things out of our control are scary, but perpetuating the belief that people just need to relax to fall pregnant is ultimately harmful.
*Unless someone was using protection and it failed, I consider that they were still trying because using/not using contraception is a choice. I appreciate that wording is nuanced and individual but I think clarity is important here.
To end of a positive note, it is absolutely possible for couples to fall pregnant naturally after years of infertility. It's just not guaranteed (and it won't be because they 'just relaxed').