This is a “Bean”. A bean is a collection of smegma, dirt, urine, and dry skin that forms in a gelding’s urethral fossa (the pocket at the tip of the horse’s sheath.) It can be waxy to the touch, have the consistency of soft cheese, and be foul smelling.
A bean many not be apparent when you are cleaning the exterior of the sheath. Discovery generally requires you to insert your finger in the fossa to find and remove the bean.
Over growth of the bean can cause discomfort and if severally overgrown can interfere with urination.
Sheath cleaning is a part of your horse’s standard hygiene needs. Some horses will allow you to clean the sheath without sedation. Many will not. If yours is a “will not” then your veterinarian will be happy to do it for you.