Lucario was originally respectful towards his master, Sir Aaron but after Sir Aaron died, Lucario, unaware of his master's sacrifice, lost all respect for Sir Aaron and grew hostile and cold towards anyone he met.
Over 1000 years ago, before the Invention of Poké Balls, Lucario served Sir Aaron, who, in turn served Lady Rin, at that time, sacrificed his life to end the war going on between two armies of Pokémon and to save Queen Rin, the Queen of Cameran Palace and her kingdom, thus becoming a legend, although Lucario did not know. Lucario thought that his master had betrayed him and his kingdom. But then later in the movie Lucario realized that Sir Aaron didn't betray him or the kingdom. Then he helped Ash Ketchum save the World but at the cost of his own life.