They did what was considered the rational at the time.
The modern view would be that investing the money can product long term economic benefits. The Saudis are trying to turn the temporary oil wealth into more permanent economic strength, so they'll remain wealthy when the oil is gone.