The broadband spectrum of a BL Lac object, OJ 287, from radio to $gamma$-rays obtained during a major $gamma$-ray flare detected by emph{Fermi} in 2009 are studied to understand the high energy emission mechanism during this episode. Using a simple one-zone leptonic model, incorporating synchrotron and inverse Compton emission processes, we show that the explanation of high energy emission from X-rays to $gamma$-rays, by considering a single emission mechanism, namely, synchrotron self-Compton (SSC) or external Compton (EC) requires unlikely physical conditions. However, a combination of both SSC and EC mechanisms can reproduce the observed high energy spectrum satisfactorily. Using these emission mechanisms we extract the physical parameters governing the source and its environment. Our study suggests that the emission region of OJ 287 is surrounded by a warm infrared (IR) emitting region of $sim 250 , K$. Assuming this region as a spherical cloud illuminated by an accretion disk, we obtain the location of the emission region to be $sim 9 pc$. This supports the claim that the $gamma$-ray emission from OJ 287 during the 2009 flare arises from a location far away from the central engine as deduced from millimeter-gamma ray correlation study and very long baseline array images.