In the original comics, the mask was apparently created in the past by an unknown tribe that originated in Africa. The shamans of that ancient tribe used a secret and mystical knowledge of magic that was infused into the Mask. This original jade mask was used in ancient rituals performed by that tribe.
In the film, the Mask was created between the end of the 4th century AD and the beginning of the 5th century AD by Loki, the Nordic god of fire and mischief. Some very old texts describe Loki as a night god and a nocturnal creature, which fits perfectly with the Mask only working at night.