From the Super Mario Wiki
Hammer Knights are large enemies in Mario Kart 8 and Mario Kart 8 Deluxe. They are statues possessed by Boos that inhabit Twisted Mansion. Two of them appear on the final leg of the track at the track's side, wielding giant hammers. When a racer gets close to them, they swing down their hammers onto the track, blocking the way for racers and potentially flattening them and causing them to stop. The ground underneath their hammers is also partially destroyed and has a Coin. Their hammers can also block incoming items, such as Green Shells and Red Shells. Occasionally, the Boos that are possessing them float out of the statues. Whenever a Hammer Knight is knocked by a Spiny Shell, Star, Bullet Bill or Super Horn, the Boo shouts in pain.