If I had a nickel for every time I've heard this at a lesson... well, it's a very common remark. There must be something almost universal about the feeling of frustration one gets after practicing a piece and underperforming at the lesson. What can we do about it?
Having felt this myself when I was taking lessons and at every masterclass I ever played at, I can relate. But after teaching and observing a parade of students expressing this same experience, I have a few thoughts about why it happens and what we can do about it.
If you think about it, you can't really expect that playing for your teacher will be the same as practicing at home, right? There you are at home, on your turf, in your comfortable and familiar surroundings, playing at the tempo you feel like and calling the shots. You get to the lesson and your teacher counts off a measure for you to come in on the downbeat, and there's an immediate disconnect. Well, one thing you can do about this is to expect it to be quite different than your practice sessions, as opposed to being the same. Sure, you'll play the same music at more or less the same tempo, but the idea that that alone should make the lesson smooth sailing will no doubt lead to unfulfilled expectations. At home, you're alone. At the lesson, you're being observed and evaluated. At home, you call the shots. At the lesson, you're being given directions. Expecting what you get at lessons instead of what it's like at home should make your lessons less frustrating.
I've found that taking a more conservative tempo helps. Playing too fast, or playing the fastest you were able to play at home when you were completely warmed up and at your very best, is asking for problems. It's better to play well a little slower than to make mistakes trying to play faster. Of course, you want to play it as fast as you hear it in your head, but you mustn't play faster than you can play cold and in good rhythm as your teacher watches.
I also equate playing music well with ice-skating. We've all seen skating competitions where champions wipe out on the ice. They have to do these incredibly athletic, complicated maneuvers, artistically rendered with passion and grace, while pleasing the audience and judges. Sounds similar to a classical guitar concert to me.
Performance anxiety is a complicated issue that deserves thoughtful study and discussion. See the Performance Anxiety Mini-Lesson to get more ideas surrounding nerves while performing and how to handle them.