WASHINGTON—Google Inc. employees have been a top source of campaign cash for President Barack Obama. A former chief executive campaigned for the president. Several company executives went to work in his administration.

Behind the scenes, though, the company has been working hard to change its profile as an ally of the Democratic Party, courting Republicans and building alliances with conservatives at a time when regulators and Congress are considering issues affecting its business interests.

...