How do websites know if the device being used is an Android phone? I was browsing a website on Chrome on my Android 4.3 phone. The website immediately showed me a popup telling me to download its Android app. So my question is how does the website know what device the user is using? And is there a way to hide the identity of my device?
Generally, a browser will have what's called a User Agent which will tell the web site what browser is currently accessing the site.
These user agents will generally tell the website whether they are a mobile device or not.  

A website can then serve up different pages or make pop ups show up when the browser that is accessing the website identifies itself as a mobile device.  

Depending on the browser, you can tell the browser to present itself as a Desktop browser rather than a Mobile browser. On Chrome for Android, this can be done by tapping the menu button and ticking "Request Desktop Site"

Check out the this wiki article for some more indepth information - http://en.wikipedia.org/wiki/User_agent