A basic and simple answer is the powder fouling from a fired cartridge, is under high pressure and temperature and builds up and bakes or forms into a, sort of ceramic layer, which can build up just forward of the neck and up the barrel, even a few inches.
Cleaning compounds and brush and jags with solvents will loosen and aid in removal.
Regular cleaning of your bore will aid in it not building up badly.