Microscopic injury to the inside of the bone causes fluid build-up which causes pain. A simple way to think of this injury is pressing on polystyrene or honeycomb and slightly crushing it. This is like a bone about to break, but not breaking.
Fortunately, bone bruising eventually heals on its own
but this can take months.
MRI
is the best investigation as it clearly shows the fluid inside the bone (see image).
Treatment includes reducing impact activities, maintaining bone health though diet and not smoking, anti-inflammatories, and medications used to treat osteoporosis (bisphosphonates, teriparatide, etc).