How come almost all movies have IPhones and macbooks in them?

Every movie I watch, if it goes to a scene where they're on their phone or laptop it's always an IPhone, MacBook, or something by apple. Why is it never Windows or something.

It's called product placement, and yes there are windows in them very often. I can name 2 off the top of my head: the computer Q uses in sky fall is a Vaio.
The computer Peter Parkers parents use is made by Sony.

Some product makers "push" their products in TV & movies.

Others are picked by the producers / directors as they look appropriate.

eg. A lot of the computers/tablet in the various CSI series have been Microsoft types.
In some other series, all the monitors have a Dell logo on the back.

Many of the laptops in "The Martian" are Panasonic toughbooks.
(They appear a lot in police / military / space stuff).
In this case, they have used a model released over ten years ago so I suspect they are the writers/directors choice rather than advertising placement.
eg. How come almost all movies have IPhones and macbooks in them - 1

It's the same with various other things, eg. Cars - many programs and movies have the main characters all using one make of car, which will be mentioned in the credits.

There's a list of computer makes in movies here (though it does seem rather out-of-date)
http://www.starringthecomputer.com/computers.html

Product placement. Apple pays them to do this.

Apple pay for the advertising. Microsoft don't.

Best quality