HSM stands for hyper sonic motor, which uses electronic signals to focus rather than a mechanical screw drive (which the D40 lacks, therefore can't focus those lenses)
so yes, HSM lenses will autofocus on D40, non-HSM lenses won't (in Sigma's line of lenses). here's a list of HSM lenses...