Your dog may be trying to dig into the carpet to make it more comfortable, as a means of releasing stress and excitement, or because they can smell something that has been on it (food or the scent of another animal).