A student pilot has been charged after he allegedly tried to enter the cockpit of an Alaska Airlines flight.