"Why would character X do thing Y?" sounds off-topic as it's asking for help with writing a story.
"Why did character X do thing Y?" is an on-topic type of question as it's asking for analysis of an existing story.
This site accepts questions about existing works of sci-fi or fantasy, including unpublished ones such as fan-fiction. One key criterion is that the work you're asking about should be available somewhere: either formally published in a book, or online, or at least such that someone other than the author has been able to read it.
Another very important point is that you must disclose your affiliation. If you're asking about a story you wrote, then you have to be up-front about the fact that you wrote it. Also, don't do this too much or you risk getting seen as a spammer, just using the site to promote your own stuff. We have a help centre page about this:
The community here tends to vote down overt self-promotion and flag it as spam. Post good, relevant answers, and if some (but not all) happen to be about your product or website, that’s okay. However, you must disclose your affiliation in your answers.
That page assumes that people are going to post answers, not questions, about their own stuff. But a lot of it still applies to your situation.
Bear in mind also that the SFF.SE community largely tends to subscribe to a "Word of God" / "authorial intent" approach to reading stories, i.e. taking the author's word about anything as final and "canonical". So if a question about a story is posted by the author themselves, then it might get a reaction along the lines of "why are you even asking? you're the author, you tell us!"
Can I ask questions about works not widely known and maybe even by me?
TL;DR: "not widely known" is fine; "by me" might work once or twice but likely won't be well received by voters, and don't overdo it.