You know, you could ask this same question about MANY more situations in English. It's like asking why the "ei" in the words "reign" and "ceiling" sound different. Javizy is absolutely correct here about what you should do.
Be that as it may, this is a pretty simple rule to keep in mind, particularly as it's an incredibly frequent (and consistent) aspect of Japanese phonology.