Welcome to the forum
He is going to be very scared and that can stop them wanting to come out if you are in the room, for example - often new owners find their piggies eat at night once nobody is watching. It’s recommended that you cover part of the top of the cage with a sheet. Piggies don’t like open spaces (they fear being attacked from above) so with a sheet covering the cage it will help him feel more safe. Put plenty of hay everywhere in the cage but particularly by the house be is in that way he can eat hay without having to come out. However if he is alone, then he is going to have a harder time settling - if he is currently alone, then the best thing you can do is get him a friend asap (today if he is a baby as babies under four months definitely should never be by themselves).
Hay is their main food intake and they need to constantly eat it to keep their system running, this means that they are constantly producing poop. Gently lift his house to clean poops out everyday - the poops are a sign he is eating. However they are an inaccurate sign as poop production is 1-2 days behind food intake - so by the time you don’t see any poops they already haven’t eaten for up to two days which means the gut has already slowed significantly. If you stop seeing poops being produced then he does need to see a vet quickly. If you have only just got him within the last day then I suspect this would be a scared issue rather than a health issue. If you have had him longer and he really isn’t eating, and you do suspect a health issue then he needs to be syringe fed and seen by a vet (urgently).
This guide explains the importance of weight checks.
Weight and Weight Loss Explained: BMI, Weighing, Poos and Feeding Support Levels
In case he really isn’t eating and you’ve had him for longer than a day -
All About Syringe Feeding and Medicating Guinea Pigs with Videos and Pictures
The main part of a guinea pigs diet must be hay. It makes around 80% of the daily food intake. Hay intake cannot by gauged by eye. You can only know a piggy is eating enough via the routine weekly weight checks (daily weight checks where there are health concerns).
Carrots, and including all fruit, are not suitable to be fed regularly or in large amounts due to the sugars. They can have one very small piece as a very occasional treat but no more than once a week.
In terms of eating other veg, veg is just one cup per pig per day which equates to around 10-15% of the daily diet. They learn what is safe by watching and trying with their companion and when they were with their mother; and if he is a pet shop piggy then they don’t get fed the variety to learn so it can take quite a long time to get them to eat a variety of veg. The four safe daily veg are lettuce (not iceberg), coriander, bell pepper and cucumber.
Pellets are just one tablespoon per pig per day, equating to just 5% of the daily diet.
Long Term Balanced General And Special Needs Guinea Pig Diets
As weepweeps has mentioned, having a friend is very important. A new piggy is a scared piggy anyway but if he doesn’t have a friend then that will make it harder for him. Piggies must never be alone - they should always be kept in pairs and their companionship needs are so high.
It can take weeks to months for a new piggy to settle in properly settle in and the guides below as well as the ones weepweeps added can help explain more about this.
Companionship
Single Guinea Pigs - Challenges and Responsibilities
Understanding Prey Animal Instincts, Guinea Pig Whispering and Cuddling Tips
Arrival in a home from the perspective of pet shop guinea pigs
How Do I Settle Shy New Guinea Pigs?