Recruiting Company mistake no. 1:
Not only did they waste your time having you commute to their office for an interview that could have probably been held over any commercially available means of transferring data over the Internet, but they fail to inform you what the purpose of their written test is. I would assume if it had some definition of purpose, such as "WRITTEN TEST FOR DATA SCIENTIST", you might have had a chance to rectify their mistake.
Recruiting Company mistake no. 2:
Their internal evaluators failed to present their project and position they were interviewing for at the beginning. Thus giving you no chance to challenge their assumption that you were there for the Data Scientist job they were interviewing for.
Recruiting Company mistake no. 3:
Their internal evaluators failed to recognise the issue you were raising (that you are being interviewed for a position you did not apply for) and did not raise your concern further up the decision chain of their employer. This spells either lack of interest or competence from their side.
Recruiting Company mistake no. 4:
After that, they made another mistake in not giving you any feedback as to how the interview went and when you could expect some reply from them.
As a result, the entire interview process failed for you, wasted your time and left you with a lot of unanswered questions and you had to go to some obscure website and ask opinions from strangers. The fact that the hiring company considers nothing wrong with this is a big red flag for me.
No, this is not OK, as the other answer might have hinted. This is not an honest mistake, this is a chain of incompetence that resulted in you suffering loss of time and self-confidence, and probably money.
Yes, you can look at this as a positive experience if you are desperate or delusional, but it really is not. The hiring company you worked with is uninterested in you at best (or incompetent).
Should you contact them inquiring if they made a mistake? Maybe, if you need closure.
Should you point out their mistakes and ask what the heck? Not worth the effort IMO.
It does matter that you spent a whole day travelling. To you at least. If you do decide to take another interview like this, ask the interviewing company for compensation. Whether they pay for your day off or your travel expenses + your day off is another matter. But you could ask. As far as this possible employer is concerned, you already accepted the interview without compensation for travel, so asking for it now is unlikely to receive a positive response.
If you want to avoid prospective employers wasting your time in the future, make sure they pay for it. Or at least compensate you in some way.
If you want to avoid your interviewer asking you questions for another position, start talking as soon as you see a human face and tell them clearly, in their language of choice, what position you are interviewing for.
If you want to avoid being rejected for a position you never applied (or worse, being accepted for it), walk out when your interviewer tells you they aren't interviewing for what you applied.