i would like to know why hawaiian airlines flight 15 out of san diego heads north to LA or San Francisco before turning towards hawaii?
Two main reasons as to why.
First would be the SIDs coming out of KSAN, which you would have the PEBLE3 or LNSAY2, which turn north towards Santa Catalina or Seal Beach. That gets them out of the airspace in San Diego on a normal, standardized route.
Secondly, there is a preferred route for arrivals to/from Hawaii, which exits ZLA airspace at the DINTY intersection to join the R576 airway. That takes you straight to Hawaii, where the airway ends at the DENNS intersection, which joins up with the MAGGI3 arrival. So Preferred routing gives everyone a common route to fly, let alone a common route from one destination to another.
In KSAN's instance, it will probably be PEBLE3.SXC DINTY R576 DENNS.MAGGI3.