For instance, if a protein is made of 2 amino acids, that is, AB, would the same protein form if the order of combination of amino acids become BA? If yes, would the behavior of interaction of that protein change? For instance, if AB interacted with another protein XY, would BA interact with XY in the same way?
The 'order' of amino acids is the protein sequence, also known as the primary structure. A peptide (short protein) with sequence XYXYXYXYX is very different from XXXXXXXYYYYYYY.
Your example is a bit trickier, since it seems like AB should be roughly equal to BA. However, each amino acid has two ends - the amino and carboxyl - and so a dipeptide like this is more like NH2-A-CONH-B-COOH with a peptide bond in between.
The really tricky question is : are two sequences 'the same' if they are different by just one or two letters. In other words is AAAAAABAAAAAA different from AAAAAACAAAAAA - and this is the study of mutations of proteins.
There is a lot more to say on this topic, of course.