It's not that hard to Google the history of either company name.
Twitter is intended to evoke the chirping of birds (hence the bird logo).
Wikipedia wrote:Twitter's origins lie in a "daylong brainstorming session" held by board members of the podcasting company Odeo. Dorsey, then an undergraduate student at New York University, introduced the idea of an individual using an SMS service to communicate with a small group. The original project code name for the service was twttr, an idea that Williams later ascribed to Noah Glass, inspired by Flickr and the five-character length of American SMS short codes. The developers initially considered "10958" as a short code, but later changed it to "40404" for "ease of use and memorability." Work on the project started on March 21, 2006, when Dorsey published the first Twitter message at 9:50 PM Pacific Standard Time (PST): "just setting up my twttr". Dorsey has explained the origin of the "Twitter" title:
...we came across the word 'twitter', and it was just perfect. The definition was 'a short burst of inconsequential information,' and 'chirps from birds'. And that's exactly what the product was.
Facebook is inherited from Harvard's Face Book. A face book is (or at least was) a kind of yearbook but of incoming freshmen or dorm images used for identification purposes.
Wikipedia wrote:Zuckerberg wrote a program called Facemash on October 28, 2003 while attending Harvard as a sophomore. According to The Harvard Crimson, the site was comparable to Hot or Not and "used photos compiled from the online facebooks of nine houses, placing two next to each other at a time and asking users to choose the 'hotter' person".
To accomplish this, Zuckerberg hacked into protected areas of Harvard's computer network and copied private dormitory ID images. Harvard did not have a student "Facebook" (a directory with photos and basic information) at the time, although individual houses had been issuing their own paper facebooks since the mid-1980s. Facemash attracted 450 visitors and 22,000 photo-views in its first four hours online.