There may be several different factors at play here — other answers raise other excellent points. But one big possible factor is what’s known in the UK as exam technique — meaning a bunch of general skills that affect exam performance, including good time management, keeping calm under pressure, and so on. Searching the keyword “exam technique” finds lots of good advice on the matter from teachers and academics, e.g. in the Newcastle University Academic Skills Kit, the Sheffield University Study Skills guide, these tips from Dave Pearce at the University of York, and these slides from Seb Savory at Cambridge University. There are many more good tips in those than I can repeat here — they’re good reading both for students, and (even more) for instructors, as a source of ideas to offer students. But the core points that come up most often fall mostly into time management and stress management.
Time management: The goal here is to make sure you’re using the time effectively. Big-picture wise, the main aim is avoid spending a lot of time stuck on hard problems, if there are easier problems that would give you more points in the same time.
So to do that, it’s usually good to skim through the whole exam for a few minutes at the start — to give this, say, 5–10 mins for a 3 hour exam. This lets you pick out which questions look easiest, so you can attempt those first. It also primes you with the rough areas of all the questions, so that your subconscious can start recalling relevant background for them all.
After that first skim, then you usually want to start with the questions that looked easiest, and proceed to harder problems after. If a problem turns out harder than expected — or if e.g. 1(a) and 1(b) are OK, but you can’t see how to do 1(c) — then don’t spend too long stuck on the hard part, especially if you’re not making progress; recognise you’re stuck, move on to another question, and come back to those skipped parts later. Get low-hanging fruit locked down first!
Stress management: The main goal here is to keep yourself calm and avoid panicking — let the pressure focus your mind, but not distract or paralyse you. There are various tactics for this, practical and psychological — of course, different things will work for different people. Practically, things that often help include breathing deeply if you catch yourself starting to panic; having a water bottle or similar to sip from; and getting some moderate physical exercise beforehand (to taste, not necessarily strenuous, but at least say a few minutes of mindful walking before the exam). Psychological tips can include reminding yourself that you’ve been able to do practice problems on this material outside the exam, for reassurance; simply reminding yourself that being calm is useful, to help consciously aim for calm; and many more.
But the common thread throughout is to have perspective on the exam and yourself — don’t let it seem overwhelmingly intimidating; don’t idealise it and see it as an eternal perfect judgement on your abilities; don’t think of it in isolation from the rest of your day and your well-being. You’re human, the examiners are human, your fellow-students are human; remember that, and do what you can to use and show your konwledge effectively.