There are some really good answers addressing why this was the wrong thing to do from an Infosec angle, and somewhat more generalized ones on the ethics of running a scan without authorization, but I'm going to try to address the "right way" to approach situations like this, based on how I would have considered addressing this in an interview if I found myself in a similar situation.
Was I right in telling them that I did that? Did I kill my chances
with them? Should I do it again with other job opportunities (if
something was discovered by accident)? How can I gain an edge in the
interview with this kind of information?
There are a couple of things going on here, particularly when it comes to gaining an edge.
For one, do you have an ethical imperative to discuss security issues which you have noticed (and I think the ethics have already been generally addressed by others).
For the second, are you stepping on toes when pointing out something wrong.
Thirdly, are you possibly creeping people out.
Finally, is this going to create a negative impression of you as a candidate due to the related interaction, even if you are right.
Change should always come from a place of knowledge, and you don't know everything about the surrounding context in an interview
As an example, in software development interviews, I've had arguments made that we should be using language xyz.
From a technical standpoint, of course there is room for improvement, and one of those improvements might be a change in language. I could make arguments as to the value in moving to certain languages all day long. But arguing it as a job candidate makes the candidate look very naive as to the surrounding concerns that might have lead to the language we're using, not to mention the technical hurdles to switching to a different language now, and it also comes across as presumptuous and possibly indicative of shallow thinking.
You don't know why the WIFI was set up that way, so don't presume that it's without intent.
Questioning is fine. I value questions during interviews a lot. Noticing things is great. You could use that if a related opening appears:
"I noticed you had an open WIFI SSID, so I thought maybe it was meant as a guest network and I could check email on it and connected briefly. As soon as I did I saw the password page and realized it must be meant as an internal network so I disconnected, but couldn't help but noticing that it didn't seem secure. As someone who cares a lot about information security, I was curious if you knew why it's set up this way?"
Digging deeper uninvited is very much not great. I think that's been covered sufficiently in other answers, but to echo Kate Gregory's answer, it's going to come across as "creepy" at best. People can argue her analogy all they want (technicalities aside, I think it captured the heart of it), but it's close enough to how most lay people are going to feel, especially when you start rattling off machines you saw. That first psychological aversion response is going to sink you, no matter how "right" you are.
At most, if a related opening naturally occurs (i.e. only if the conversation actually continues when you bring up the first part) you might ask if they'd considered running some scans to check whether anyone is at risk via that WIFI, and what their preferred vulnerability testing tools are. That gives a clear window (and opportunity for them to ask related questions back about your own preferences) into your related skill… but don't push it. You are not the head of IT, you are here for an interview, and while you might disagree with what they're doing it's also not your place to argue for something different unless invited, because you could just as easily be making a fool of yourself in their specific context.
If asked "Oh, that's interesting, what would you do", that would be your opening to discuss the scans you might run to show the vulnerabilities and how you would then put forward a proposal for a change to the WIFI, assuming there were not externalities you weren't aware of as someone not part of the company related to the particular installation that necessitated it being set up like this: and if so, how you might mitigate them via VLANs, internal firewalling, etc, but it would really require knowing more particulars. Being open about what you don't know in terms of context is encouraging: with details about what you'd need to learn about the environment it can help show degrees of your related skill and knowledge, and your discerning flexibility to account for different situations.
Don't (even inadvertently or unintentionally) insult people
This goes along with the preceding, but I really want to focus on it for a moment: start from a presumption of intelligence in others. It's flattering. The opposite is insulting. If something doesn't appear "smart" from an outside perspective, begin with the assumption that there are other reasons with a foundation of intelligence and skill on the part of those involved. Even if you don't stick your foot in your mouth horribly by having overlooked something as a possibility, ultimately being right isn't going to matter after you've just finished trashing someone you're asking to hire you.
Don't lose sight of the goal
If you want to see change occur, be an advocate for yourself and your generalized views and outlooks and skills (and how they align with your interviewers/the company, which is going to require getting them to talk about that: so ask!), not for the specific change you want to implement when it is merely a single detail.
If seeing a likely security lapse fires you up, great. But you can't become so focused on that specific issue that you derail the interview in a way that leaves you looking weaker as an overall candidate. That won't get the problem solved. Getting hired might. So re-focus your related caring and intensity into advocating yourself, rather than a relatively less meaningful back and forth on one single security detail. You'll have plenty of time to advocate on that specific issue once you're hired.
Feel people out (and hopefully create natural openings)
Not only do you not know the technical context and surrounding constraints that lead to a situation like this open WIFI network, but you more importantly don't know the people you're talking to, their personalities, and their involvement and opinions on this and similar issues.
It's one thing to offer up your expertise and give examples, it's another thing to push. Confidence in yourself and your skills is good (it's great), but pushiness is rarely something an interviewer is looking for, in my own experience.
So just remember that these people are strangers who you've had a short amount of time to gain an acquaintance of in a very narrow, very constrained way. Don't push yourself on them: find out what they think instead.
Rather than reeling off on them about what your opinion is on a given technical topic (which can easily look negative to someone less technical, and can easily step you into landmines with someone more technical), ask them what they do currently in relation to that topic, and if necessary then ask what the individual's opinion is. It shows the sophistication of knowledge to know what to ask about without pushing your opinions and thoughts on them, and gives you some space to feel them out.
Ultimately, this provides the best openings, because you can do something like mention things like WIFI being difficult in mixed use environments (assuming the topic comes up) and then asking what they do as company, and what the interviewer's personal preferences are in relation to that. This perhaps provides possible openings for the earlier hypothetical statement I offered, but it also warns you if maybe it might be best to not say anything at all.
Even more than just the openings, this also helps expose dynamics between different interviewers. When you have multiple people interviewing you, you are the center of attention, and it's hard to gauge everything going on well. Asking questions and then asking opinions gives you room to (discretely, since your focus should be on whoever is talking while they are talking) watch what's going on. You'll have opportunities to switch (or even direct) focus between different people, or at least look around to gauge consensus/etc on answers given to you. This will depend, by degrees, on how "on rails" the interview format is.
Leave room for conversation to breath
Yes, you're here to advocate for you, but just you shouting how good you are doesn't necessarily do that effectively. Your resume should already speak for itself in technical and experiential terms, what you're really here for is to speak for yourself as someone to work with, as a coworker and colleague.
And here's the key to that: as they say in writing, "show, don't just tell".
If they ask for your opinion or stance on something, give it, certainly. But when it's not being asked, ASK theirs instead as your opening. Let that naturally lead back to them asking for your own opinion (or not). You'll show just as much related knowledge in asking about topics as you would trying to talk yourself up, but more importantly it comes across less pretentiously and gives you room to look more like someone who would be good to work with on related issues rather than someone who is just going to try to push over everyone else while thinking they already know everything that needs to be known.
There's technical stuff thrown into most in person interviews, but ideally it's just there as a check of whether or not you live up to your resume, and really the ultimate goal of an interview at that stage is to figure out whether you'd be someone they want to work with. We've skipped otherwise technically competent people because of the way they acted during their interview, and how they approached (or even didn't) the related interaction. Because a job is about more than just paper knowledge and basic technical competence. Anyone can run a pen scanner. Not everyone can discern when is the right time to do so and how to effectively use the results if they do, and not step all over everyone's toes in the process so horribly that no one cares anymore and everyone just wants the project canceled and something else worked on.
In some environments, being able to effectively negotiate through project advocacy and related internal political life cycles is just as crucial as having the related technical knowledge. So show your competence at how you interact with your interviewers, make yourself out to be someone easy to work with and to communicate with, who is self confident in the best of ways, the one where they don't just need to blather continually about themselves. And someone discerning who knows when to push something, when not to, and how much.
The hardest thing to regain is trust
You're in an interview situation: you have been granted a basic level of trust in being invited to interview, but you are still a relatively unknown quantity, so it's very much provisional. Anything that puts the trust already given to you in question is absolutely poisonous to your chances as a candidate. You should always assume there are other candidates (for example, in my case, we do things like fail and rework searches that don't yield enough interview candidates to form an adequate comparison pool). You should always assume they are equally qualified in terms of technical qualifications.
Do not engage in actions during an interview that could lead anyone present to calling into question whether you are trustworthy. Actions which are normally associated with a higher level of trust than you have clearly—I would even say explicitly—been granted (you don't ask someone you don't trust to run a security scan, and by default you begin by distrusting someone who randomly runs a penetration scan against you without your express invitation and permission) fall under this. It's not that you are being distrusted, it's that you haven't yet been granted the levels of trust associated with actions of that nature. You need to earn that, and taking actions associated with higher levels of trust before doing so is often immediately seen as overstepping your bounds, in ways that call your decision making skills into question too, and in a first impression situation you can't afford that.
Even if you can regain the base level of trust you're interviewing with, having it ever questioned can quickly put you in jeopardy compared to other candidates. It's rarely spoken of directly, because we run things like background checks to try to ascertain whether we're correct in trusting someone, but the sense of individual and direct trust is a crucial one to not betray during an interview process, because it will easily loom over all other personality and skill impressions if someone at any point becomes "uneasy" with you over an action you take. Ultimately, ascertaining whether you can be trusted is really a core element of an interview, when you really think about it.