It’s the safer option than going into combat at an effective range for a heavy piece of machinery. ATGMs are typically accurate amd can be attached on anything.
They may be safer and everything but fighters destroying each other with guns is way cooler than a fighter jet firing a missile 4 kilometres away from the enemy