I'm a photography enthusiast and I'm looking to buy a canon 4000d and a lens for it, but am not sure whether it's compatible with a canon 4000d or not.
Each camera manufacturer has a lens mount designed to match their cameras with their lenses.
The original Canon autofocus lens mount (1987 and on) is the EF mount. Every SLR/DSLR Canon autofocus body made since then can attach to EF lenses.
When digital was introduced, it used a smaller sensor size than the size of film (this is the difference between APS-C sized sensors and "full frame" sensors). Lenses designed for this smaller format are designated EF-S. EF-S lenses, due to the smaller image circle they project, will not fit Full Frame cameras but will fit APS-C.
For this reason, a Full Frame camera like the 5D mark 3 has the listed mount of "EF" while your 4000D is listed as "EF-S".
What is not immediately apparent is the fact that any EF-S camera can also use EF lenses.
Essentially, you can use any Canon SLR Autofocus lens. If you are shopping third party lenses, make sure they say "For Canon", "For Canon EF", or "For Canon EF-S". As long as they list that they are "For Canon," it'll attach.
Side note: Canon has lenses designed for their mirrorless cameras designated EF-M and RF mount. Neither of these will fit your camera. Stick to EF and EF-S.