Nikon D40 is the first entry level DSLR from Nikon that made the DSLRs affordable for the masses. For a struggling student like myself, it was the perfect DSLR to get started with interchangeable lens cameras (ILCs). I’ve shot quality compact film cameras in the past, such as the Nikon L35AF2. As well as some cheaper digital cameras from the mid-aughts. I have yet to see what an APS-C sized sensor digital camera is capable of. Ken Rockwell at one point famously called this camera his favourite. During the lifespan of the D40 it is certainly a very competitive camera in its price range.
The Nikon D40 was special to me because it is my first DSLR. The kit lens, the Nikon AF-S DX NIKKOR 18-55mm F3.5-5.6G II (mouthful I know) accompanied me during a month long trip to Brazil. There were moments I wish I had brought a longer lens for wild life, or a faster lens for the evenings, but the DX 18-55mm served me fairly well in most situations. I later acquired the DX 35mm F1.8 and a Sigma 18-200mm F3.5-6.3 superzoom. The combination of the superzoom and a fast normal prime became my go to kit for some years.
My problem with the D40 was that Nikon, as well as Canon, largely ignores the demographic by refusing to produce high-end lenses for their crop format cameras. DX and EF-S lenses from the duopoly are mostly kit zooms. There are a few gems but neither systems cover the enough focal lengths for a complete kit. Many will say that you can mount a full frame FX or EF lens on these bodies, but while the focal lengths can be worked around by multiplying the crop factors, the perspective of those lenses do not change! The lenses specifically designed for the crop format accommodate for both focal lengths (multiplying crop factor) and perspective (by lens design). For a beginner this can be a difficult concept to grasp while learning a myriad of other things about photography.
I would not recommend it or any of Nikon or Canon’s entry-level DSLRs for the beginners as crop format mirrorless cameras with advanced features and better image quality can be had for a bit more money, and they all have arguably better upgrade paths with much more lenses to choose from.