Why is public key cryptography (RSA) used in sites like Google or Facebook? The RSA algorithm is used for encryption (plain text to cipher text) and decryption (cipher text to plain text) of data. What is the need for using public keys in these sites; why is data is encrypted as everything is viewed by everyone?

Why do we need to use public key cryptography in Google; how does it provide security?
[I assume you're talking about Google's web search service, and not Gmail.]

Google doesn't encrypt the web page data in storage, because it's not secret data.  Encryption is optionally used by users to securely communicate with Google, and that's different.  

Using certificate based keys and encryption assures the users that they are communicating with the Real Google and not a Fake Google that could give them false results.  It also protects the users' privacy from eavesdroppers; so if someone was searching for 'cancer' their employer or family wouldn't know.