We consider a dilute and ultracold bosonic gas of weakly-interacting atoms. Within the framework of quantum field theory we derive a zero-temperature modified Gross-Pitaevskii equation with beyond-mean-field corrections due to quantum depletion and anomalous density. This result is obtained from the stationary equation of the Bose-Einstein order parameter coupled to the Bogoliubov-de Gennes equations of the out-of-condensate field operator. We show that, in the presence of a generic external trapping potential, the key steps to get the modified Gross-Pitaevskii equation are the semiclassical approximation for the Bogoliubov-de Gennes equations, a slowly-varying order parameter, and a small quantum depletion. In the uniform case, from the modified Gross-Pitaevskii equation we get the familiar equation of state with Lee-Huang-Yang correction.