Originally a 'custard' was a kind of open pie containing an egg-set confection, often with meat or fruit, such as the ancient Crustard or Doucette. The word derives from the pie casing, the 'crust', and only later did it get transferred to the egg-mixture.