"Military grunt" is slang for an infantryman or foot soldier. It is thought that this term arose during the Vietnam War. This usage was first recorded in print in 1969.
Since around 1900, "grunt" has been a word for a low-level worker or laborer. This is the likely origin of the term "grunt work," referring to a job that is thankless, boring and exhausting but necessary. There is no record of how this word became applied to infantrymen though it is indisputable that infantrymen often engage in grunt work.
The military branches love to label themselves and one another with made-up acronyms, or backronyms. For this reason, it's sometimes jokingly claimed that "grunt" stands for either "Government Reject Unfit for Naval Training" or "Ground Replacement Unit, Not Trained."