Why would you do that?
When my friend say "I'm gonna wear weird costume.", could I say "Why would you do that?" in future meaning?
When my friend say "I took your panties yesterday.", could I say "Why would you do that?" too? in past situation?
Solution 1:
In this case, "would" is not indicating an action in the future.
This is an example of the second conditional. The second conditional is used for unlikely events. The events you describe may very well be unlikely, depending on the context.
This kind of question might be better asked at the English Language Learners Stackexchange.