Set the entitlement of a case based on record type
Well done on your first try for Apex code.

A few pointers:


Record types aren't always available for all users, when doing logic on Record types by Name I usually add a Formula to retrieve the name (one less query and I can control the permissions)
Don't add queries in for loops, you could / would hit SOQL limits very very quicly


I haven't proven that this will work but here is an example of what you should do:

trigger SetCaseEntitlementOnInsert on Case (before insert) {
    System.debug('SetCaseEntitlementOnInsert executed');

    // 1) Loop through the Case(s) to be inserted.
    // 2) Get the Entitlement for each based on the RecordType.
    // 3) Retrieve the Entitlement.   
    // 4) Assign the Entitlement to the Case

    // Assuming you create a custom field with a Formula to retrieve RecordType.Name with API name RecordTypeName__c

    // Collection of Entitlement Names
    Set&lt;String&gt; theEntitlementNames = new Set&lt;String&gt; {
        'Priority 1',
        'Priority 2',
        'Priority 3',
        'Priority 4'
    };

    // Query the Entitelments
    List&lt;Entitlement&gt; theEntitlements = [SELECT Id, Name FROM Entitlement WHERE Name IN :theEntitlementNames];

    // If we have Entitlements
    if (!theEntitlements.isEmpty()) {

        // Map the Entitlement Ids by Name
        Map&lt;String, Id&gt; theEntitlementIdsByName = new Map&lt;String, Id&gt;();
        for (Entitlement theEntitlement : theEntitlements) {
            theEntitlementIdsByName.put(theEntitlement.Name, theEntitlement.Id);
        }

        // Now for each Case
        for (Case theCase : Trigger.New) {
            if (theCase.RecordTypeName__c == 'Trouble Tickets') {
                theCase.EntitlementId = theEntitlementIdsByName.get(theEntitlementNames[0]);
            } else if (theCase.RecordTypeName__c == 'Access Request/New Hire') {
                theCase.EntitlementId = theEntitlementIdsByName.get(theEntitlementNames[1]);
            } else if (theCase.RecordTypeName__c == 'Purchase Order') {
                theCase.EntitlementId = theEntitlementIdsByName.get(theEntitlementNames[2]);
            } else {
                theCase.EntitlementId = theEntitlementIdsByName.get(theEntitlementNames[3]);
            }
        }

    }
}