I hear it all the time still even though it was born probably in jest by a gym bro 50 years ago. The "no pain, no gain" manta is a stupid one, and one that has gotten a lot of people in trouble with chronic pain that they will be dealing with for the rest of their lives.
You do need to put stress on your muscles if you want them to grow but the idea that you have to hurt yourself in order to achieve progress is a recipe for disaster.
A certain amount of soreness from the gym is not necessarily a bad thing but it is something that you should definitely listen to your body about, especially if you have a nagging pain in a part of your body that isn't even a muscle.
For me, I have something like a "tennis elbow" on my right arm. This is really annoying as far as weight are concerned because so many of the "men's favorite" exercises revolve around using that part of your body. Anything related to biceps or triceps necessitates the use of this area and I have to be very careful to not overdo it or I am going to be in trouble the next day.
There are a lot of things that you can and should do to prevent this sort of injury and mostly this is just involving using proper form and not stressing parts of your body that you aren't actually targeting. For me, I can still do heavy curls if I want to, but I am going to end up regretting having done so. My tendons in my elbow and wrist simply can't handle it anymore and while some beefcake might tell you to "man up" and push through the pain, this is terrible advice. At the end of the day when you experience pain, your body is trying to tell you that you are doing something wrong and you need to investigate what that is.
Everyone is built different and some people's bodies can take a lot more damage than others. For me, a great deal of my breakability comes from the fact that I am a bit older now and for much of my life I was exercising improperly without my knowledge. I am a big believer in that proper form is much more important that the amount you are lifting and I think that nearly every trainer in the world would agree with this notion.
The gym is not a place to "fuck around and find out."
One of my favorite bodybuilders of all time is Calum von Moger and he was an absolute beast. He ended up playing Arnold Schwarzenegger in a film and was super-human huge. Calum also suffered some pretty horrible injuries in the gym and one of them, the worst one, happened while he was screwing around doing an exercise that isn't even an exercise. He was show-off curling a really heavy stack with someone else beside him when his bicep snapped.
This basically spelled the end of his bodybuilding career. That's ok though because he revised his routine, slimmed down, and i think he looks better in his new shape than his really impractical and definitely roided out look.
I'm getting a bit off topic here. The point is that "no pain no gain" is a really stupid slogan or belief system. You definitely should pay attention to pain and learn from it. It should never be an objective when you are working out. It is possible to achieve gains the safe way that wont end up being a back or neck problem that you have to deal with for the rest of your life.
I made mistakes so that you don't have to. Because of improper methods of working out I now have problems in multiple body parts that I will likely have to deal with for the rest of my life. Don't make the same mistakes as me!