There are multiple ways with which electromagnetic waves can be produced. One of them is by accelerating a charged particle. Such waves are produced when electrical and magnetic fields coincide. The electrical field, denoted as E, and magnetic field which is denoted by B, are always mutually perpendicular. As shown in figure below (Source), They do travel in a straight line as you can see. An important point to note is that all EM waves travel at the speed of light (3 × 108m/s). In space, their velocity remains unaffected.