This is one of those questions that lives in a legal gray area, and the short answer usually comes down to whether you can show you legitimately owned the copy in the first place.
In principle, buying a game grants you a license to use that software. If you purchased a disc years ago and it was lost, stolen, or destroyed, many people feel entitled to obtain the same title again. However, downloading a copy from an unofficial source is still generally considered copyright infringement, regardless of ownership, because the distribution itself is unauthorized.
The safest routes are legitimate ones: repurchasing the game, using a digital storefront that lets you re-download titles you already bought, or contacting the publisher for a replacement. Keeping your receipt or proof of purchase can help if you ever need to demonstrate ownership, but it does not automatically make an unauthorized download legal.