Credit scoring providers have access to huge stores of data from various other companies (mainly finance and utility companies) and they use this historical credit data to check if you have defaulted on any loans in the past or if you regularly pay your bills late.
The exact algorithms credit scoring companies use are not transparent to the public, or to the companies that use their services. However, you can find out more about the three NZ credit reporting bureaus here.