IIRC, Google even asks developers to have funny side-projects, to work on useless things, to explore whatever ideas they have, to be creative. It allows them to expand their skillset, and sometimes one of those funny-silly-project becomes a real project. Gmail was one of those.