Matej was born on the 31st of December, 1882, in what is now Gbely, Slovakia, and he emigrated to the US at the age of 24. After a year, he enlisted in the US Marine Corps in Pittsburgh, Pennsylvania, and his first enlistment ended after four years but within two months he reenlisted the day after Christmas 1911 in New York City. Matej lived in Binghamton, New York while assigned to the Marine Barracks at the Navy Yard in New York and he also spent some time with the US Army in Vera Cruz, Mexico in 1914. He reenlisted again in 1915 and was assigned to New Orleans.
Matej served in the Dominican Republic against the native bandits before returning to the States to be assigned to Quantico and deploying to France in support of World War 1. Seven months into his deployment, he displayed actions that would earn him both the Army and Navy Medals of Honor. The citations read:
When the advance of his battalion was checked by a hidden machine-gun nest, he went forward alone, unprotected by covering fire from his own men, and worked in between the German positions in the face of fire from enemy covering detachments. Locating the machine-gun nest, he rushed it and with his bayonet drove off the crew. Shortly after this he organized 25 French colonial soldiers who had become separated from their company and led them in attacking another machine-gun nest, which was also put out of action.
For extraordinary heroism while serving with the Sixty-sixth Company, Fifth Regiment, Second Division, in action in the Villers-Cotterêts section, south of Soissons, France, 18 July 1918. When a hidden machine-gun nest halted the advance of his battalion, Sergeant Kocak went forward alone unprotected by covering fire and worked his way in between the German positions in the face of heavy enemy fire. Rushing the enemy position with his bayonet, he drove off the crew. Later the same day, Sergeant Kocak organized French colonial soldiers who had become separated from their company and led them in an attack on another machine-gun nest which was also put out of action.
Matej became one of five Marines to receive both branch's Medals during World War 1. Three months later, during the Battle of Blanc Mont Ridge, he was killed in action on the 4th of October, 1918. Matej Kocak is buried in the Meuse-Argonne American Cemetery and Memorial in Meuse, France: Section D, Row 41, Grave 32.