Thank you for your question regarding your poor cat who has had his head shut in a door! As you can imagine, this could have potentially caused a large range of issue including a fractured skull and/or spine, spinal cord issue, soft tissue trauma around the head and neck, and of course neurological issues. The increased respiratory rate is most likely due to pain, but could also potentially be due to a neurological issue, or a primary respiratory issue as a result of the trauma.
Whatever the case - you need to get your cat seen by your local vet straight away. Here they will be able to give your cat some pain relief straight away, and then start to assess what issues there are here, what can potentially be done to assist this little one, or even assess whether it is fairy to have your cat put down. Ultimately this will all depend on your cat's symptoms and whether there is any paralysis as a result of this trauma.
Please get your cat straight down to your vet now. There isn't anything else you can do from home for this sort of situation, and as your cat is breathing quickly, we know that he is either in a lot of pain, or has a primary respiratory issue, both of which would require emergency assessment and treatment. I hope all of the above makes sense? If you have more questions or if I can help in any other way, please do not hesitate to ask! If you would like to accept my answer, please press RATE OUR CONVERSATION (I am not compensated in any other way).
PS: If you have additional questions after you rate the question, you are welcome to request me for additional conversations if I am on-line or by beginning your question "Dr. E..." or "Pet-doc..." and others will leave the questions for me.