The Captain probably thought the copilot was unconscious or otherwise incapacitated...
____________________________________
No, once the captain punched the emergency access code into the keypad and the door did not open 30 seconds latter, he KNEW that the co-pilot had intentionally locked him out.
That definitely raised his anxiety level another notch. So did the descent. He didn't lose hope yet. He may have thought he did something wrong or the door malfunctioned -- because it was UNTHINKABLE to him that another pilot would do such a thing. Once he gave up on the keypad he started chopping at the door. That's when the passengers knew -- and when they started screaming.
They'll never release the CVR feed, too much drama.