Larry Page and Sergey Brin's at first created the BackRub - Google's precursor. BackRub was Page's research project at Stanford University. It used the university's domain.
The guys used their own algorithm (PageRank) for rating sites by their backlinks to design BackRub. Search engines were more focused on keywords, not on backlinks at that time.
Later, they changed their search engine's name to Google, and the domain was called google.stanford.edu. The company's first office was at a garage they were renting for $1.700 monthly. They set up the Google.com domain there.
Their search engine got good reviews and beat the competition. It was more innovative and gave better results.
Google grew through word of mouth. Also, in the early days, Google let companies pay for placement. The more they paid, the higher they were in the search results.
Later, Google managed to strike deals with Yahoo, Netscape, and AOL. For every 1k queries, Google got $8-$10. Google was underestimated by its competitors, and that gave it much advantage.
[source]