VMware Fusion and Parallels make creating OS X guests very easy, they can do this using the downloaded OS X installer from the App Store, VirtualBox however is old school and very, very fussy. VirtualBox will only accept either the old DVD retail installer disc for e.g. Snow Leopard (Server), or an ISO image created from say Lion, Mountain Lion, Mavericks or Yosemite. It will not accept a DMG.
DiskMakerX used to be able to create ISO images - this was back in the Lion DiskMaker era, it no longer has this function. There are various articles out there on how to do this in Terminal.app. I can confirm that this approach does work for VirtualBox, however the steps differ between Lion, Mountain Lion and Mavericks/Yosemite, I have not yet tried El Capitan.
It might also be possible to do this using say DeployStudio or similar as a NetBoot server and getting the VirtualBox guest to boot/install via that. This approach again works in VMware Fusion and Parallels and even ESXi.
While one cannot grumble about the price of VirtualBox - like Oracle's other projects i.e. MySQL and Java their attention to Mac details is very, very poor.
(Why is it that tech companies with bosses that used to be Apple board directors are some of the worst companies in terms of the quality of their Mac products? As mentioned above this applies to Larry Ellison/Oracle and also applied to Bill Campbell/Intuit.)
Note: To get OS X guests to work in VirtualBox apart from the above it seems there is also a lot of black magic involved. Yes sticking with the default 2GB memory allocation helps, it is also necessary to leave it set to use a single CPU core. See comment about their attention to Mac details is poor.