Origin of nematic order in FeSe