Diagnosis
The plastic tabs on the filter housing or the corresponding slots on the dryer body have worn down or broken. This is a physical wear issue, often from frequent removal or being dropped while the filter is attached.
How to Fix It
Inspect the filter's plastic rim. You should see two small plastic tabs on opposite sides. Check if they are cracked or missing. Then, look inside the filter port on the dryer. Ensure there's no broken plastic debris lodged in there. If the tabs on the *filter* are broken, you need a new filter (Dyson sells them). If the receiver on the *dryer* is broken, it needs service.
If That Didn't Work
Sometimes, if the filter isn't perfectly aligned (it only goes on one way), it won't seat. Look for the alignment arrow on the filter and match it to the dot on the dryer body. Push firmly until you hear/feel a distinct click on both sides.
Heads Up
Don't try to glue or tape the filter on. The dryer needs that filter to be removable for cleaning, and a loose filter will cause overheating and shutdowns. Running it without the filter is a great way to kill the motor very quickly.