When I first saw this question it had more downvotes than upvotes. But I think it is a reasonable question related to system performance and the differences between AMD and Intel processors. I think there are a couple of points worth addressing.
ISA Licensing
As I have always understood it, AMD built their CPUs by reverse
engineering Intel's instruction set and now pay Intel to use their
instruction set, and Intel do the same for AMDs 64-bit instructions.
I don't know the full history of AMD and Intel license agreement for x86, but this is a bit of an oversimplification. Currently AMD and Intel have a cross licensing agreement that allows both of them to implement the same ISA. For instance the 64-bit extensions to the x86 ISA were developed by AMD back when Intel was pushing the Itanium ISA. Regardless it is true that both AMD and Intel support the same core x86 ISA now and they generally have extensions to it that are compatible with each other.
Overall performance
Firstly, I've noticed some games have been a bit laggy on my system
(AMD) and after reading it turns out the game is optimised for Intel
CPUs...
The overall performance of program execution depends on three basic things. The number of instructions that need to be executed, the frequency of the CPU (clock speed), and the number of instructions executed per cycle (per clock tick). Currently high-end Intel CPUs tend to have better overall performance than AMD CPUs, even when executing the exact same application that does not have any specific optimizations. So it's likely that if the game is slow on your system it is just because the CPU is too slow, rather than because it's optimized for a particular microarchitecture. Also there could be other factors (GPU tends to matter the most for gaming), but debugging the performance of a game isn't going to be on-topic for stackoverflow, unless you are a game developer trying to understand a specific coding problem.
CPU Specific Optimizations
What does it mean to be optimised for Intel or AMD? How can it be
possible to be different / optimised for one but not the other, if
they are meant to be slot in replacements for each other? I.e both
support same instructions etc.
Although Intel and AMD both develop CPUs that run x86 applications, the internal microarchitecture of the CPUs is different. And there is not simply an Intel microarchitecture or an AMD microarchitecture. Instead each company has various different groups of CPUs that it develops under a specific microarchitecture. So a program could be optimized for Skylake (and Intel microarchitecture) or Bulldozer (an AMD microarchitecture).
When the compiler is generating code it can make very minor tweaks that might benefit one microarchitecture more than another. If a developer doesn't know what the target CPU family is then it might make sense not to target a specific microarchitecture and simply generate code that is expected to perform the best overall. But if the developer know which microarchitecture the program will run on then it can be possible to get a slight performance improvement by specializing for that microarchitecture.
Usually these performance gains are pretty small compared to the baseline optimization. One exception is when a new feature like SSE4 is available. In that case it could make a big difference for certain workloads that are able to take advantage of the new feature. But even then the optimization is more specific to that feature than a specific processor vendor since both AMD and Intel support SSE4 now.