How should i know its the night. Its not referring to the night.
Simpler translation: "The captain sleeps aboard the ship" (Nakhoda itu tidur di atas kapal"). "Menginap" in this context is a bit convoluted; however, it is okay to say "Nakhoda itu menginap di hotel" or "Nakhoda itu menginap di rumah temannya".
duo's own dictionary says "menginap" can also mean "to stay". So "That captain stays aboard the ship." should be correct and accepted.
di atas kapal translates to on top of or atop the ship, Isn't there another term for on board or aboard the ship?