Private Pyle and Forrest Gump were in Vietnam for the same reason.
Both of them were probably "New Standards Men", or more bluntly, "Macnamara's Morons". These were recruits who entered the Armed Forces through a program called "Project 100,000" which involved very relaxed standards in recruiting.
The project was dreamed up by Defense Secretary Robert MacNamara, ostensibly as a means of improving the lives of underprivileged and unqualified/uneducated American men by providing them with training and experience which would carry over to their civilian lives after their service.
The men recruited through this program fell far short of normal mental and physical requirements for service. Some were grossly over or under weight. Some would be considered autistic today. They could not pass physical or mental tests and in many cases, able personnel took their tests for them. Some of the men were even considered mentally retarded, in the terminology of the 1960s.
Macnamara's Morons died at triple the rate of the usual soldier or marine in Vietnam.
https://en.wikipedia.org/wiki/Project_100,000