There’s actually multiple questions here.
The hiring process has an application “filter” layer, a candidate selection layer, and THEN the interview with the person/people who actually want to hire you. Sometimes there’s an extra technical interview after that.
These days, the filter layer is mostly automated. Asking the filter why it didn’t select you is like asking a Machine Learning model why it chose to do something a certain way — you aren’t going to get a useful response.
So the only way to figure it out is trial and error: vary your application in terms of structure and content until you find the combination that makes it last the current batch of filters.
OR
Find a way to skip the filters altogether by finding someone on the inside of the company to flag up your CV to the people looking to fill the position.
Once past the filter, you get to HR, and if you get this far, asking questions about why you didn’t get selected to continue will actually be met with a useful response (unless it’s a company you don’t want to work for). HR will tell you the basic things they’re looking for in an application, and possibly how you compared in certain criteria to the stronger candidates.
Next you get to the manager. If you get this far, you can usually have this discussion at the end of your interview. They’re looking for fit for the role, and you can ask questions about fit as part of the interview process.
And finally you get to the technical interview. If you get this far and don’t get the job, the reason why is usually fairly obvious: either they had someone who was both a better fit AND understood the problem domain / demonstrated an ability to learn and reflect the team culture better, or you failed to prove technical ability in a key area.