Assuming you're referring to FakeNameGenerator.com then the data is generated by putting random data in the format of various types of information. For example a fake address from FakeNameGenerator would combine the name of a real street in the actual city of that street with the actual zip code of that city, with a randomly generated house number appended to those. In the case of a SSN random numbers are place in the XX-XXXX-XXX format. Similar techniques are used for the rest of the data.
To address the second part of your question this information works when filling out forms or registering on websites because the forms do not check the information across the proper databases (because it would be too expensive usually) to verify its real. You should never use FakeNameGenerator information when registering for something important like a bank account, a credit card, or a loan.