Official documentation: http://erlang.org/doc/tutorial/nif.html
NIFs were introduced in Erlang/OTP R13B03 as an experimental feature. The purpose is to allow calling C-code from inside Erlang code.
NIFs are implemented in C instead of Erlang, but they appear as any other functions in the scope of Erlang code as they belong to the module where the include happened. NIF libraries are linked on compilation and loaded in runtime.
Because NIF libraries are dynamically linked into the emulator process, they are fast, but also dangerous, because crashing in a NIF brings the emulator down too.