A density oscillator exhibits limit-cycle oscillations driven by the density difference of the two fluids. We performed two-dimensional hydrodynamic simulations with a simple model, and reproduced the oscillatory flow observed in experiments. As the density difference is increased as a bifurcation parameter, a damped oscillation changes to a limit-cycle oscillation through a supercritical Hopf bifurcation. We estimated the critical density difference at the bifurcation point and confirmed that the period of the oscillation remains finite even around the bifurcation point.