Why Is My Kitten Going Potty So Much?

my kitten urinated on the carpet and tried to eat it. i’ve had him since he was four weeks old, but this is the first time he’s done something like this. what should i do?