Which country exploded its first underground nuclear device?

Many, but the US Buster-Jangle Uncle effects test was the first. It was 1.2KTons exploded at a depth of about 3 feet, to test cratering effects. It produced massive fallout levels. Most underground testing is done much deeper to prevent contamination.