An alarm was triggered on an Air India Express flight from Bengaluru to Varanasi after a passenger attempted to access the cockpit.