Post: See this post by Rabbi Yaakov Haber who addresses this question, in another form. If they were great men, why did they do this? Based on the Seforno, because they thought that Yosef would be Yaakov's choice and that they would become the chaff.
This is also addressed in midrash, if we want to adopt a more "maximalist" perspective on the avos keeping the Torah. For example, this pasuk:
|17. And the man said, "They have traveled away from here, for I overheard them say, 'Let us go to Dothan.' " So Joseph went after his brothers, and he found them in Dothan.||יז. וַיֹּאמֶר הָאִישׁ נָסְעוּ מִזֶּה כִּי שָׁמַעְתִּי אֹמְרִים נֵלְכָה דֹּתָיְנָה וַיֵּלֶךְ יוֹסֵף אַחַר אֶחָיו וַיִּמְצָאֵם בְּדֹתָן:|
where Rashi offers the following explanation:
|‘Let us go to Dothan.’: Heb. נֵלְכָה דֹתָינָה, to seek regarding you legal pretexts (נִכְלֵי דָתוֹת), by which they could put you to death. According to its simple meaning, however, it is a place-name, and a Biblical verse never loses its simple sense.||נלכה דתינה: לבקש לך נכלי דתות שימיתוך בהם. ולפי פשוטו שם מקום הוא, ואין מקרא יוצא מדי פשוטו:|
Thus, perhaps their actions were done in an halachic manner.
If I might suggest a justification of the brothers' actions, I would suggest as follows. Obviously, they knew of the pesukim in Devarim 18 which state:
Elsewhere, a navi is lumped together with a cholem chalomot, of prophetic dreams, in this regard. Now, they knew that Yosef was offering prophetic dreams, and they believed these prophecies to be false. Thus, looking to parashat Vayeishev:
|8. So his brothers said to him, "Will you reign over us, or will you govern us?" And they continued further to hate him on account of his dreams and on account of his words.||ח. וַיֹּאמְרוּ לוֹ אֶחָיו הֲמָלֹךְ תִּמְלֹךְ עָלֵינוּ אִם מָשׁוֹל תִּמְשֹׁל בָּנוּ וַיּוֹסִפוּ עוֹד שְׂנֹא אֹתוֹ עַל חֲלֹמֹתָיו וְעַל דְּבָרָיו:|
They didn't think he would ever rule over them. Thus, he was uttering false prophetic dreams. Thus, regarding his dreams and his words relating the false dreams. In terms of the second dream:
This prophetic dream couldn't come true, for Yosef's mother, Rachel, had already passed away! Indeed, the best proof is when they decide to kill Yosef:
They know that they are going to kill him. Therefore, neither of his dreams could come to fruition. Therefore, he is a navi sheker who is deserving of death.
(This in contrast to Rashi / midrash that וְנִרְאֶה מַה יִּהְיוּ חֲלֹמֹתָיו is a statement by Hashem, rather than by the brothers.)
Their decision to kill Yosef is thus not an aveira, chas veShalom. It is a mitzvah, and is carrying out the Torah's instructions!