Origin of nonthermal emission from the Fermi bubbles and mechanisms of particle acceleration there