In addition to that, putting user-supplied content on separate domains allows GitHub to list those domains in https://publicsuffix.org/, which they did:
// GitHub, Inc.
// Submitted by Ben Toews <…@github.com> 2014-02-06
github.io
githubusercontent.com
Apple/Google/Microsoft/Mozilla use this list to restrict cookies -- foo.github.io can't set a cookie for github.io, even though it normally would be permitted. This list is also used to highlight the address bar, so "foo" would be emphasized, rather than "foo.github".