Should we use the rest of a grant that we have achieved its goal to make further research not very useful in the direction of proposal?

Different funding agencies (and programs within agencies) have different relationships with the specificity that they want in results. Some are much more comfortable with their investigators "following where the science leads," while others really care about the exact pre-specified goals of the project.

Without further information about the funder and the type of grant, it's impossible to say what degree of flexibility there is likely to be in how the money gets used. The definitive source for this information is generally the program manager for the grant, and your supervisor should have been having periodic interactions with the program manager that could provide guidance on this decision. If they haven't, that's a warning sign, but that may be difficult for you to know since students are rarely included in such interactions in any case.

Taking actions that go against the funder regulations or program manager guidance can cause big trouble. The risk is primarily for your supervisor, but you might get tarnished by association, particularly if you knew an action was dubious and didn't talk to anybody. If there are other professors that you know and trust (or a university ombudsperson or ethics office), you might talk to them to be able to share more details and get a more informed opinion---as well as to shield yourself from possible negative consequences if your misgivings prove well founded.